mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[FIX] package: Auto-update package-lock.json
This commit updates the version in package-lock.json and make it so it is automatically and correctly updated at each new release.
This commit is contained in:
committed by
Sam Degueldre
parent
64de716b91
commit
94ae940e82
Generated
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@odoo/owl",
|
||||
"version": "2.0.9",
|
||||
"version": "2.1.0",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
// do not modify manually. This value is updated by the release script.
|
||||
// do not modify manually. This file is generated by the release script.
|
||||
export const version = "2.1.0";
|
||||
|
||||
+6
-7
@@ -1,4 +1,5 @@
|
||||
const package = require("../package.json");
|
||||
const packageLock = require("../package-lock.json");
|
||||
const readline = require("readline");
|
||||
const fs = require("fs");
|
||||
const exec = require("child_process").exec;
|
||||
@@ -41,7 +42,6 @@ async function startRelease() {
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
log(`Step 1/${STEPS}: collecting info...`);
|
||||
const current = package.version;
|
||||
let next = await ask("Next version: ");
|
||||
if (next[0] === 'v') next = next.substring(1);
|
||||
let file = await ask(`Release notes (${REL_NOTES_FILE}): `);
|
||||
@@ -85,8 +85,9 @@ async function startRelease() {
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
log(`Step 3/${STEPS}: updating package.json...`);
|
||||
await replaceInFile("./package.json", current, next);
|
||||
await replaceInFile("./src/version.ts", current, next);
|
||||
await writeFile("package.json", JSON.stringify({...package, version: next}, null, 2) + "\n");
|
||||
await writeFile("package-lock.json", JSON.stringify({...packageLock, version: next}, null, 2) + "\n");
|
||||
await writeFile("./src/version.ts", `// do not modify manually. This file is generated by the release script.\nexport const version = "${next}";\n`);
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
log(`Step 4/${STEPS}: creating git commit...`);
|
||||
@@ -246,11 +247,9 @@ function readFile(file) {
|
||||
});
|
||||
}
|
||||
|
||||
async function replaceInFile(file, from, to) {
|
||||
const content = await readFile(file);
|
||||
function writeFile(file, content) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const updatedContent = content.replace(new RegExp(from, "g"), to);
|
||||
fs.writeFile(file, updatedContent, "utf8", err => {
|
||||
fs.writeFile(file, content, "utf8", err => {
|
||||
if (err) {
|
||||
reject(err);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user