@anolilab/semantic-release-preset 2.2.1 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/README.md +8 -43
- package/dist/postinstall.d.ts +1 -0
- package/dist/postinstall.js +24 -0
- package/dist/postinstall.js.map +1 -0
- package/dist/postinstall.mjs +22 -0
- package/dist/postinstall.mjs.map +1 -0
- package/package.json +34 -34
- package/lib/postinstall.js +0 -111
- /package/{.releaserc-with-npm.json → config/with-npm.json} +0 -0
- /package/{.releaserc-without-npm.json → config/without-npm.json} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,27 @@
|
|
|
1
|
+
## @anolilab/semantic-release-preset [3.1.0](https://github.com/anolilab/javascript-style-guide/compare/@anolilab/semantic-release-preset@3.0.0...@anolilab/semantic-release-preset@3.1.0) (2023-06-11)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* changed export for npm and no npm semantic-release config ([5af5fd6](https://github.com/anolilab/javascript-style-guide/commit/5af5fd6a35d1e1e88bd55a6cd4795bb1830392ff))
|
|
7
|
+
* transformed package to use cjs and mjs ([500503e](https://github.com/anolilab/javascript-style-guide/commit/500503e7d7e8ad2a8d7a448a94d82b4a0afc52ff))
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
* postinstall.ts should use the @anolilab/semantic-release-preset/npm for the extends key ([8975abc](https://github.com/anolilab/javascript-style-guide/commit/8975abc6de5fb2838671c8cae89ebfb5b6fcf21d))
|
|
13
|
+
|
|
14
|
+
## @anolilab/semantic-release-preset [3.0.0](https://github.com/anolilab/javascript-style-guide/compare/@anolilab/semantic-release-preset@2.2.1...@anolilab/semantic-release-preset@3.0.0) (2023-06-10)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### ⚠ BREAKING CHANGES
|
|
18
|
+
|
|
19
|
+
* Changed the package to support cjs and mjs, so the type module was removed
|
|
20
|
+
|
|
21
|
+
### Features
|
|
22
|
+
|
|
23
|
+
* switched js to ts, created a new package-utils package ([5477591](https://github.com/anolilab/javascript-style-guide/commit/5477591aa46d878b8535ff8503384e27ca537a7f))
|
|
24
|
+
|
|
1
25
|
## @anolilab/semantic-release-preset [2.2.1](https://github.com/anolilab/javascript-style-guide/compare/@anolilab/semantic-release-preset@2.2.0...@anolilab/semantic-release-preset@2.2.1) (2023-05-25)
|
|
2
26
|
|
|
3
27
|
|
package/README.md
CHANGED
|
@@ -52,7 +52,7 @@ With npm:
|
|
|
52
52
|
|
|
53
53
|
```json
|
|
54
54
|
{
|
|
55
|
-
"extends": "@anolilab/semantic-release-preset"
|
|
55
|
+
"extends": "@anolilab/semantic-release-preset/npm"
|
|
56
56
|
}
|
|
57
57
|
```
|
|
58
58
|
|
|
@@ -60,7 +60,7 @@ Without npm:
|
|
|
60
60
|
|
|
61
61
|
```json
|
|
62
62
|
{
|
|
63
|
-
"extends": "@anolilab/semantic-release-preset
|
|
63
|
+
"extends": "@anolilab/semantic-release-preset"
|
|
64
64
|
}
|
|
65
65
|
```
|
|
66
66
|
|
|
@@ -304,7 +304,7 @@ jobs:
|
|
|
304
304
|
|
|
305
305
|
- uses: "pnpm/action-setup@v2.2.4"
|
|
306
306
|
with:
|
|
307
|
-
version:
|
|
307
|
+
version: 8
|
|
308
308
|
run_install: false
|
|
309
309
|
|
|
310
310
|
- name: "Set node version to ${{ matrix.node_version }}"
|
|
@@ -313,25 +313,6 @@ jobs:
|
|
|
313
313
|
node-version: "${{ matrix.node_version }}"
|
|
314
314
|
cache: "pnpm"
|
|
315
315
|
|
|
316
|
-
- name: "Get pnpm store directory"
|
|
317
|
-
id: "pnpm-cache"
|
|
318
|
-
run: |
|
|
319
|
-
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
|
|
320
|
-
|
|
321
|
-
- uses: "actions/cache@v3"
|
|
322
|
-
name: "Setup pnpm cache"
|
|
323
|
-
with:
|
|
324
|
-
path: "${{ steps.pnpm-cache.outputs.STORE_PATH }}"
|
|
325
|
-
key: "${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}"
|
|
326
|
-
restore-keys: |
|
|
327
|
-
${{ runner.os }}-pnpm-store-
|
|
328
|
-
|
|
329
|
-
# @see: https://github.com/pnpm/pnpm/issues/4348
|
|
330
|
-
- name: "Upgrade npm to 8.4 version"
|
|
331
|
-
run: "npm install --global npm@8.4"
|
|
332
|
-
env:
|
|
333
|
-
SKIP_CHECK: "true"
|
|
334
|
-
|
|
335
316
|
- name: "Check npm version"
|
|
336
317
|
run: "npm -v"
|
|
337
318
|
env:
|
|
@@ -368,7 +349,7 @@ jobs:
|
|
|
368
349
|
|
|
369
350
|
- uses: "pnpm/action-setup@v2.2.4"
|
|
370
351
|
with:
|
|
371
|
-
version:
|
|
352
|
+
version: 8
|
|
372
353
|
run_install: false
|
|
373
354
|
|
|
374
355
|
- name: "Use Node.js 16.x"
|
|
@@ -377,25 +358,6 @@ jobs:
|
|
|
377
358
|
node-version: "16.x"
|
|
378
359
|
cache: "pnpm"
|
|
379
360
|
|
|
380
|
-
- name: "Get pnpm store directory"
|
|
381
|
-
id: "pnpm-cache"
|
|
382
|
-
run: |
|
|
383
|
-
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
|
|
384
|
-
|
|
385
|
-
- uses: "actions/cache@v3"
|
|
386
|
-
name: "Setup pnpm cache"
|
|
387
|
-
with:
|
|
388
|
-
path: "${{ steps.pnpm-cache.outputs.STORE_PATH }}"
|
|
389
|
-
key: "${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}"
|
|
390
|
-
restore-keys: |
|
|
391
|
-
${{ runner.os }}-pnpm-store-
|
|
392
|
-
|
|
393
|
-
# @see: https://github.com/pnpm/pnpm/issues/4348
|
|
394
|
-
- name: "Upgrade npm to 8.4 version"
|
|
395
|
-
run: "npm install --global npm@8.4"
|
|
396
|
-
env:
|
|
397
|
-
SKIP_CHECK: "true"
|
|
398
|
-
|
|
399
361
|
- name: "Check npm version"
|
|
400
362
|
run: "npm -v"
|
|
401
363
|
env:
|
|
@@ -407,6 +369,9 @@ jobs:
|
|
|
407
369
|
- name: "Build Production"
|
|
408
370
|
run: "pnpm run build:prod:packages"
|
|
409
371
|
|
|
372
|
+
- name: "npm v8.5+ requires workspaces-update to be set to false"
|
|
373
|
+
run: "echo 'workspaces-update=false' >> .npmrc"
|
|
374
|
+
|
|
410
375
|
- name: "Semantic Release"
|
|
411
376
|
if: "success()"
|
|
412
377
|
env:
|
|
@@ -437,7 +402,7 @@ jobs:
|
|
|
437
402
|
|
|
438
403
|
- uses: "pnpm/action-setup@v2.2.4"
|
|
439
404
|
with:
|
|
440
|
-
version:
|
|
405
|
+
version: 8
|
|
441
406
|
|
|
442
407
|
- name: "Use Node.js 16.x"
|
|
443
408
|
uses: "actions/setup-node@v3"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var packageJsonUtils = require('@anolilab/package-json-utils');
|
|
5
|
+
var fs = require('fs');
|
|
6
|
+
var path = require('path');
|
|
7
|
+
var util = require('util');
|
|
8
|
+
|
|
9
|
+
process.env.CI&&process.exit(0);var r=util.promisify(fs.writeFile);console.log("Configuring @anolilab/semantic-release-preset",packageJsonUtils.projectPath,`
|
|
10
|
+
`);var u=()=>{if(packageJsonUtils.pkg&&(packageJsonUtils.hasDevelopmentDep(["multi-semantic-release","@qiwi/multi-semantic-release"])||packageJsonUtils.hasDep(["multi-semantic-release","@qiwi/multi-semantic-release"])))return console.warn("\u26A0\uFE0F found use of multi-semantic-release;"),Promise.resolve();let e=path.join(packageJsonUtils.projectPath,".releaserc.json");return fs.existsSync(e)?(console.warn("\u26A0\uFE0F .releaserc.json already exists;"),Promise.resolve()):r(e,`{
|
|
11
|
+
"extends": "@anolilab/semantic-release-preset/npm"
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
`,"utf-8")},p=()=>{let e=path.join(packageJsonUtils.projectPath,"commitlint.config.js");return fs.existsSync(e)?(console.warn("\u26A0\uFE0F commitlint.config.js already exists;"),Promise.resolve()):r(e,`${packageJsonUtils.packageIsTypeModule?"export default":"module.exports ="} {
|
|
15
|
+
extends: ["@commitlint/config-conventional"],
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
`,"utf-8")},w=()=>{let e=path.join(packageJsonUtils.projectPath,".czrc");return fs.existsSync(e)?(console.warn("\u26A0\uFE0F .czrc already exists;"),Promise.resolve()):r(e,`{
|
|
19
|
+
"path": "cz-conventional-changelog"
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
`,"utf-8")};(async()=>{try{await u(),await p(),await w(),console.log("\u{1F60E} Everything went well, have fun!"),process.exit(0);}catch(e){console.log("\u{1F62C} something went wrong:"),console.error(e),process.exit(1);}})();
|
|
23
|
+
//# sourceMappingURL=out.js.map
|
|
24
|
+
//# sourceMappingURL=postinstall.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/postinstall.ts"],"names":["hasDep","hasDevelopmentDep","packageIsTypeModule","pkg","projectPath","existsSync","writeFile","join","promisify","writeFileAsync","writeReleaseRc","releaseRcPath","writeCommitLintConfig","commitlintPath","writeCzrc","filePath","error"],"mappings":";AAEA,OACC,UAAAA,EAAQ,qBAAAC,EAAmB,uBAAAC,EAAqB,OAAAC,EAAK,eAAAC,MAC/C,+BACP,OAAS,cAAAC,EAAY,aAAAC,MAAiB,KACtC,OAAS,QAAAC,MAAY,OACrB,OAAS,aAAAC,MAAiB,OAEtB,QAAQ,IAAI,IAEZ,QAAQ,KAAK,CAAC,EAGlB,IAAMC,EAAiBD,EAAUF,CAAS,EAE1C,QAAQ,IAAI,gDAAiDF,EAAa;AAAA,CAAI,EAK9E,IAAMM,EAAiB,IAAM,CACzB,GACIP,IACIF,EAAkB,CAAC,yBAA0B,8BAA8B,CAAC,GAAKD,EAAO,CAAC,yBAA0B,8BAA8B,CAAC,GAEtJ,eAAQ,KAAK,oDAA0C,EAEhD,QAAQ,QAAQ,EAG3B,IAAMW,EAAgBJ,EAAKH,EAAa,iBAAiB,EAEzD,OAAIC,EAAWM,CAAa,GACxB,QAAQ,KAAK,+CAAqC,EAE3C,QAAQ,QAAQ,GASpBF,EAAeE,EANN;AAAA;AAAA;AAAA;AAAA,EAM8B,OAAO,CACzD,EAKMC,EAAwB,IAAM,CAChC,IAAMC,EAAiBN,EAAKH,EAAa,sBAAsB,EAE/D,OAAIC,EAAWQ,CAAc,GACzB,QAAQ,KAAK,oDAA0C,EAEhD,QAAQ,QAAQ,GASpBJ,EAAeI,EANN,GAAGX,EAAsB,iBAAmB;AAAA;AAAA;AAAA;AAAA,EAMb,OAAO,CAC1D,EAKMY,EAAY,IAAM,CACpB,IAAMC,EAAWR,EAAKH,EAAa,OAAO,EAE1C,OAAIC,EAAWU,CAAQ,GACnB,QAAQ,KAAK,qCAA2B,EAEjC,QAAQ,QAAQ,GASpBN,EAAeM,EANN;AAAA;AAAA;AAAA;AAAA,EAMyB,OAAO,CACpD,GAGC,SAAY,CACT,GAAI,CACA,MAAML,EAAe,EACrB,MAAME,EAAsB,EAC5B,MAAME,EAAU,EAEhB,QAAQ,IAAI,4CAAqC,EAEjD,QAAQ,KAAK,CAAC,CAClB,OAASE,EAAP,CACE,QAAQ,IAAI,kCAA2B,EACvC,QAAQ,MAAMA,CAAK,EAEnB,QAAQ,KAAK,CAAC,CAClB,CACJ,GAAG","sourcesContent":["#!/usr/bin/env node\n\nimport {\n hasDep, hasDevelopmentDep, packageIsTypeModule, pkg, projectPath,\n} from \"@anolilab/package-json-utils\";\nimport { existsSync, writeFile } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { promisify } from \"node:util\";\n\nif (process.env[\"CI\"]) {\n // eslint-disable-next-line no-undef\n process.exit(0);\n}\n\nconst writeFileAsync = promisify(writeFile);\n\nconsole.log(\"Configuring @anolilab/semantic-release-preset\", projectPath, \"\\n\");\n\n/**\n * Writes .releaserc.json if it doesn't exist. Warns if it exists.\n */\nconst writeReleaseRc = () => {\n if (\n pkg\n && (hasDevelopmentDep([\"multi-semantic-release\", \"@qiwi/multi-semantic-release\"]) || hasDep([\"multi-semantic-release\", \"@qiwi/multi-semantic-release\"]))\n ) {\n console.warn(\"⚠️ found use of multi-semantic-release;\");\n\n return Promise.resolve();\n }\n\n const releaseRcPath = join(projectPath, \".releaserc.json\");\n\n if (existsSync(releaseRcPath)) {\n console.warn(\"⚠️ .releaserc.json already exists;\");\n\n return Promise.resolve();\n }\n\n const content = `{\n \"extends\": \"@anolilab/semantic-release-preset/npm\"\n}\n\n`;\n\n return writeFileAsync(releaseRcPath, content, \"utf-8\");\n};\n\n/**\n * Writes commitlint.config.js if it doesn't exist. Warns if it exists.\n */\nconst writeCommitLintConfig = () => {\n const commitlintPath = join(projectPath, \"commitlint.config.js\");\n\n if (existsSync(commitlintPath)) {\n console.warn(\"⚠️ commitlint.config.js already exists;\");\n\n return Promise.resolve();\n }\n\n const content = `${packageIsTypeModule ? \"export default\" : \"module.exports =\"} {\n extends: [\"@commitlint/config-conventional\"],\n};\n\n`;\n\n return writeFileAsync(commitlintPath, content, \"utf-8\");\n};\n\n/**\n * Writes .czrc if it doesn't exist. Warns if it exists.\n */\nconst writeCzrc = () => {\n const filePath = join(projectPath, \".czrc\");\n\n if (existsSync(filePath)) {\n console.warn(\"⚠️ .czrc already exists;\");\n\n return Promise.resolve();\n }\n\n const content = `{\n \"path\": \"cz-conventional-changelog\"\n}\n\n`;\n\n return writeFileAsync(filePath, content, \"utf-8\");\n};\n\n// eslint-disable-next-line unicorn/prefer-top-level-await\n(async () => {\n try {\n await writeReleaseRc();\n await writeCommitLintConfig();\n await writeCzrc();\n\n console.log(\"😎 Everything went well, have fun!\");\n // eslint-disable-next-line no-undef\n process.exit(0);\n } catch (error) {\n console.log(\"😬 something went wrong:\");\n console.error(error);\n // eslint-disable-next-line no-undef\n process.exit(1);\n }\n})();\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { projectPath, pkg, hasDevelopmentDep, hasDep, packageIsTypeModule } from '@anolilab/package-json-utils';
|
|
3
|
+
import { writeFile, existsSync } from 'fs';
|
|
4
|
+
import { join } from 'path';
|
|
5
|
+
import { promisify } from 'util';
|
|
6
|
+
|
|
7
|
+
process.env.CI&&process.exit(0);var r=promisify(writeFile);console.log("Configuring @anolilab/semantic-release-preset",projectPath,`
|
|
8
|
+
`);var u=()=>{if(pkg&&(hasDevelopmentDep(["multi-semantic-release","@qiwi/multi-semantic-release"])||hasDep(["multi-semantic-release","@qiwi/multi-semantic-release"])))return console.warn("\u26A0\uFE0F found use of multi-semantic-release;"),Promise.resolve();let e=join(projectPath,".releaserc.json");return existsSync(e)?(console.warn("\u26A0\uFE0F .releaserc.json already exists;"),Promise.resolve()):r(e,`{
|
|
9
|
+
"extends": "@anolilab/semantic-release-preset/npm"
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
`,"utf-8")},p=()=>{let e=join(projectPath,"commitlint.config.js");return existsSync(e)?(console.warn("\u26A0\uFE0F commitlint.config.js already exists;"),Promise.resolve()):r(e,`${packageIsTypeModule?"export default":"module.exports ="} {
|
|
13
|
+
extends: ["@commitlint/config-conventional"],
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
`,"utf-8")},w=()=>{let e=join(projectPath,".czrc");return existsSync(e)?(console.warn("\u26A0\uFE0F .czrc already exists;"),Promise.resolve()):r(e,`{
|
|
17
|
+
"path": "cz-conventional-changelog"
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
`,"utf-8")};(async()=>{try{await u(),await p(),await w(),console.log("\u{1F60E} Everything went well, have fun!"),process.exit(0);}catch(e){console.log("\u{1F62C} something went wrong:"),console.error(e),process.exit(1);}})();
|
|
21
|
+
//# sourceMappingURL=out.js.map
|
|
22
|
+
//# sourceMappingURL=postinstall.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/postinstall.ts"],"names":["hasDep","hasDevelopmentDep","packageIsTypeModule","pkg","projectPath","existsSync","writeFile","join","promisify","writeFileAsync","writeReleaseRc","releaseRcPath","writeCommitLintConfig","commitlintPath","writeCzrc","filePath","error"],"mappings":";AAEA,OACC,UAAAA,EAAQ,qBAAAC,EAAmB,uBAAAC,EAAqB,OAAAC,EAAK,eAAAC,MAC/C,+BACP,OAAS,cAAAC,EAAY,aAAAC,MAAiB,KACtC,OAAS,QAAAC,MAAY,OACrB,OAAS,aAAAC,MAAiB,OAEtB,QAAQ,IAAI,IAEZ,QAAQ,KAAK,CAAC,EAGlB,IAAMC,EAAiBD,EAAUF,CAAS,EAE1C,QAAQ,IAAI,gDAAiDF,EAAa;AAAA,CAAI,EAK9E,IAAMM,EAAiB,IAAM,CACzB,GACIP,IACIF,EAAkB,CAAC,yBAA0B,8BAA8B,CAAC,GAAKD,EAAO,CAAC,yBAA0B,8BAA8B,CAAC,GAEtJ,eAAQ,KAAK,oDAA0C,EAEhD,QAAQ,QAAQ,EAG3B,IAAMW,EAAgBJ,EAAKH,EAAa,iBAAiB,EAEzD,OAAIC,EAAWM,CAAa,GACxB,QAAQ,KAAK,+CAAqC,EAE3C,QAAQ,QAAQ,GASpBF,EAAeE,EANN;AAAA;AAAA;AAAA;AAAA,EAM8B,OAAO,CACzD,EAKMC,EAAwB,IAAM,CAChC,IAAMC,EAAiBN,EAAKH,EAAa,sBAAsB,EAE/D,OAAIC,EAAWQ,CAAc,GACzB,QAAQ,KAAK,oDAA0C,EAEhD,QAAQ,QAAQ,GASpBJ,EAAeI,EANN,GAAGX,EAAsB,iBAAmB;AAAA;AAAA;AAAA;AAAA,EAMb,OAAO,CAC1D,EAKMY,EAAY,IAAM,CACpB,IAAMC,EAAWR,EAAKH,EAAa,OAAO,EAE1C,OAAIC,EAAWU,CAAQ,GACnB,QAAQ,KAAK,qCAA2B,EAEjC,QAAQ,QAAQ,GASpBN,EAAeM,EANN;AAAA;AAAA;AAAA;AAAA,EAMyB,OAAO,CACpD,GAGC,SAAY,CACT,GAAI,CACA,MAAML,EAAe,EACrB,MAAME,EAAsB,EAC5B,MAAME,EAAU,EAEhB,QAAQ,IAAI,4CAAqC,EAEjD,QAAQ,KAAK,CAAC,CAClB,OAASE,EAAP,CACE,QAAQ,IAAI,kCAA2B,EACvC,QAAQ,MAAMA,CAAK,EAEnB,QAAQ,KAAK,CAAC,CAClB,CACJ,GAAG","sourcesContent":["#!/usr/bin/env node\n\nimport {\n hasDep, hasDevelopmentDep, packageIsTypeModule, pkg, projectPath,\n} from \"@anolilab/package-json-utils\";\nimport { existsSync, writeFile } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { promisify } from \"node:util\";\n\nif (process.env[\"CI\"]) {\n // eslint-disable-next-line no-undef\n process.exit(0);\n}\n\nconst writeFileAsync = promisify(writeFile);\n\nconsole.log(\"Configuring @anolilab/semantic-release-preset\", projectPath, \"\\n\");\n\n/**\n * Writes .releaserc.json if it doesn't exist. Warns if it exists.\n */\nconst writeReleaseRc = () => {\n if (\n pkg\n && (hasDevelopmentDep([\"multi-semantic-release\", \"@qiwi/multi-semantic-release\"]) || hasDep([\"multi-semantic-release\", \"@qiwi/multi-semantic-release\"]))\n ) {\n console.warn(\"⚠️ found use of multi-semantic-release;\");\n\n return Promise.resolve();\n }\n\n const releaseRcPath = join(projectPath, \".releaserc.json\");\n\n if (existsSync(releaseRcPath)) {\n console.warn(\"⚠️ .releaserc.json already exists;\");\n\n return Promise.resolve();\n }\n\n const content = `{\n \"extends\": \"@anolilab/semantic-release-preset/npm\"\n}\n\n`;\n\n return writeFileAsync(releaseRcPath, content, \"utf-8\");\n};\n\n/**\n * Writes commitlint.config.js if it doesn't exist. Warns if it exists.\n */\nconst writeCommitLintConfig = () => {\n const commitlintPath = join(projectPath, \"commitlint.config.js\");\n\n if (existsSync(commitlintPath)) {\n console.warn(\"⚠️ commitlint.config.js already exists;\");\n\n return Promise.resolve();\n }\n\n const content = `${packageIsTypeModule ? \"export default\" : \"module.exports =\"} {\n extends: [\"@commitlint/config-conventional\"],\n};\n\n`;\n\n return writeFileAsync(commitlintPath, content, \"utf-8\");\n};\n\n/**\n * Writes .czrc if it doesn't exist. Warns if it exists.\n */\nconst writeCzrc = () => {\n const filePath = join(projectPath, \".czrc\");\n\n if (existsSync(filePath)) {\n console.warn(\"⚠️ .czrc already exists;\");\n\n return Promise.resolve();\n }\n\n const content = `{\n \"path\": \"cz-conventional-changelog\"\n}\n\n`;\n\n return writeFileAsync(filePath, content, \"utf-8\");\n};\n\n// eslint-disable-next-line unicorn/prefer-top-level-await\n(async () => {\n try {\n await writeReleaseRc();\n await writeCommitLintConfig();\n await writeCzrc();\n\n console.log(\"😎 Everything went well, have fun!\");\n // eslint-disable-next-line no-undef\n process.exit(0);\n } catch (error) {\n console.log(\"😬 something went wrong:\");\n console.error(error);\n // eslint-disable-next-line no-undef\n process.exit(1);\n }\n})();\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anolilab/semantic-release-preset",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "Anolilab Coding Standard for semantic-release.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"anolilab",
|
|
@@ -34,61 +34,61 @@
|
|
|
34
34
|
"name": "Daniel Bannert",
|
|
35
35
|
"email": "d.bannert@anolilab.de"
|
|
36
36
|
},
|
|
37
|
-
"
|
|
38
|
-
|
|
37
|
+
"exports": {
|
|
38
|
+
".": {
|
|
39
|
+
"require": "./config/without-npm.json",
|
|
40
|
+
"import": "./config/without-npm.json"
|
|
41
|
+
},
|
|
42
|
+
"./npm": {
|
|
43
|
+
"require": "./config/with-npm.json",
|
|
44
|
+
"import": "./config/with-npm.json"
|
|
45
|
+
},
|
|
46
|
+
"./package.json": "./package.json"
|
|
47
|
+
},
|
|
48
|
+
"main": "config/without-npm.json",
|
|
49
|
+
"source": "src/postinstall.ts",
|
|
39
50
|
"files": [
|
|
40
|
-
"
|
|
51
|
+
"dist",
|
|
41
52
|
"README.md",
|
|
42
53
|
"CHANGELOG.md",
|
|
43
54
|
"LICENSE.md",
|
|
44
|
-
"
|
|
45
|
-
"
|
|
55
|
+
"config/with-npm.json",
|
|
56
|
+
"config/without-npm.json"
|
|
46
57
|
],
|
|
47
58
|
"scripts": {
|
|
48
|
-
"
|
|
59
|
+
"build": "cross-env NODE_ENV=development tsup",
|
|
60
|
+
"build:prod": "cross-env NODE_ENV=production tsup",
|
|
61
|
+
"clean": "rimraf node_modules dist",
|
|
62
|
+
"postinstall": "node ./skip.js || node ./dist/postinstall.js"
|
|
49
63
|
},
|
|
50
64
|
"dependencies": {
|
|
51
|
-
"@
|
|
52
|
-
"@commitlint/
|
|
53
|
-
"@commitlint/
|
|
65
|
+
"@anolilab/package-json-utils": "1.2.0",
|
|
66
|
+
"@commitlint/cli": "^17.6.5",
|
|
67
|
+
"@commitlint/config-conventional": "^17.6.5",
|
|
68
|
+
"@commitlint/core": "^17.6.5",
|
|
54
69
|
"@semantic-release/changelog": "^6.0.3",
|
|
55
|
-
"@semantic-release/commit-analyzer": "^
|
|
70
|
+
"@semantic-release/commit-analyzer": "^10.0.1",
|
|
56
71
|
"@semantic-release/exec": "^6.0.3",
|
|
57
72
|
"@semantic-release/git": "^10.0.1",
|
|
58
|
-
"@semantic-release/github": "^
|
|
59
|
-
"@semantic-release/
|
|
60
|
-
"@semantic-release/
|
|
73
|
+
"@semantic-release/github": "^9.0.3",
|
|
74
|
+
"@semantic-release/npm": "^10.0.4",
|
|
75
|
+
"@semantic-release/release-notes-generator": "^11.0.3",
|
|
61
76
|
"commitizen": "^4.3.0",
|
|
62
|
-
"conventional-changelog-conventionalcommits": "^
|
|
77
|
+
"conventional-changelog-conventionalcommits": "^6.0.0",
|
|
63
78
|
"cz-conventional-changelog": "^3.3.0",
|
|
64
79
|
"semantic-release-conventional-commits": "^3.0.0"
|
|
65
80
|
},
|
|
66
81
|
"devDependencies": {
|
|
67
|
-
"semantic-release": "^21.0.
|
|
82
|
+
"semantic-release": "^21.0.4"
|
|
68
83
|
},
|
|
69
84
|
"peerDependencies": {
|
|
70
|
-
"semantic-release": "^
|
|
85
|
+
"semantic-release": "^21.0.0"
|
|
71
86
|
},
|
|
72
87
|
"engines": {
|
|
73
88
|
"node": ">=16"
|
|
74
89
|
},
|
|
75
90
|
"publishConfig": {
|
|
76
|
-
"access": "public"
|
|
77
|
-
|
|
78
|
-
"pnpm": {
|
|
79
|
-
"overrides": {
|
|
80
|
-
"glob-parent@<5.1.2": ">=5.1.2",
|
|
81
|
-
"minimist@<1.2.6": ">=1.2.6",
|
|
82
|
-
"chrono-node@<2.2.4": ">=2.2.4",
|
|
83
|
-
"yargs-parser@>=6.0.0 <13.1.2": ">=13.1.2",
|
|
84
|
-
"trim@<0.0.3": ">=0.0.3",
|
|
85
|
-
"trim-newlines@<3.0.1": ">=3.0.1",
|
|
86
|
-
"moment@<2.29.2": ">=2.29.2",
|
|
87
|
-
"semver-regex@<3.1.4": ">=3.1.4",
|
|
88
|
-
"got@<11.8.5": ">=11.8.5",
|
|
89
|
-
"moment@>=2.18.0 <2.29.4": ">=2.29.4",
|
|
90
|
-
"ansi-regex@>=3.0.0 <3.0.1": ">=3.0.1",
|
|
91
|
-
"ansi-regex@>=4.0.0 <4.1.1": ">=4.1.1"
|
|
92
|
-
}
|
|
91
|
+
"access": "public",
|
|
92
|
+
"provenance": true
|
|
93
93
|
}
|
|
94
94
|
}
|
package/lib/postinstall.js
DELETED
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import { existsSync, readFileSync, writeFile } from "node:fs";
|
|
4
|
-
import { join, resolve } from "node:path";
|
|
5
|
-
import { promisify } from "node:util";
|
|
6
|
-
|
|
7
|
-
// eslint-disable-next-line no-undef
|
|
8
|
-
if (process.env.CI) {
|
|
9
|
-
// eslint-disable-next-line no-undef
|
|
10
|
-
process.exit(0);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const writeFileAsync = promisify(writeFile);
|
|
14
|
-
|
|
15
|
-
// get the path to the host project.
|
|
16
|
-
// eslint-disable-next-line no-undef
|
|
17
|
-
const projectPath = resolve(process.cwd(), "..", "..", "..");
|
|
18
|
-
|
|
19
|
-
console.log("Configuring @anolilab/semantic-release-preset", projectPath, "\n");
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Writes .releaserc.json if it doesn't exist. Warns if it exists.
|
|
23
|
-
*/
|
|
24
|
-
const writeReleaserc = () => {
|
|
25
|
-
const packageJsonPath = join(projectPath, "package.json");
|
|
26
|
-
|
|
27
|
-
if (existsSync(packageJsonPath)) {
|
|
28
|
-
const packageJsonContent = readFileSync(packageJsonPath, "utf8");
|
|
29
|
-
|
|
30
|
-
if (packageJsonContent.includes("multi-semantic-release")) {
|
|
31
|
-
console.warn("⚠️ found use of multi-semantic-release;");
|
|
32
|
-
|
|
33
|
-
return Promise.resolve();
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const filePath = join(projectPath, ".releaserc.json");
|
|
38
|
-
|
|
39
|
-
if (existsSync(filePath)) {
|
|
40
|
-
console.warn("⚠️ .releaserc.json already exists;");
|
|
41
|
-
|
|
42
|
-
return Promise.resolve();
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
const content = `{
|
|
46
|
-
"extends": "@anolilab/semantic-release-preset"
|
|
47
|
-
}
|
|
48
|
-
`;
|
|
49
|
-
|
|
50
|
-
return writeFileAsync(filePath, content, "utf-8");
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Writes commitlint.config.cjs if it doesn't exist. Warns if it exists.
|
|
55
|
-
*/
|
|
56
|
-
const writeCommitlintConfig = () => {
|
|
57
|
-
const filePath = join(projectPath, "commitlint.config.cjs");
|
|
58
|
-
|
|
59
|
-
if (existsSync(filePath)) {
|
|
60
|
-
console.warn("⚠️ commitlint.config.cjs already exists;");
|
|
61
|
-
|
|
62
|
-
return Promise.resolve();
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
const content = `module.exports = {
|
|
66
|
-
extends: ["@commitlint/config-conventional"],
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
`;
|
|
70
|
-
|
|
71
|
-
return writeFileAsync(filePath, content, "utf-8");
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Writes .czrc if it doesn't exist. Warns if it exists.
|
|
76
|
-
*/
|
|
77
|
-
const writeCzrc = () => {
|
|
78
|
-
const filePath = join(projectPath, ".czrc");
|
|
79
|
-
|
|
80
|
-
if (existsSync(filePath)) {
|
|
81
|
-
console.warn("⚠️ .czrc already exists;");
|
|
82
|
-
|
|
83
|
-
return Promise.resolve();
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
const content = `{
|
|
87
|
-
"path": "cz-conventional-changelog"
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
`;
|
|
91
|
-
|
|
92
|
-
return writeFileAsync(filePath, content, "utf-8");
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
// eslint-disable-next-line unicorn/prefer-top-level-await
|
|
96
|
-
(async () => {
|
|
97
|
-
try {
|
|
98
|
-
await writeReleaserc();
|
|
99
|
-
await writeCommitlintConfig();
|
|
100
|
-
await writeCzrc();
|
|
101
|
-
|
|
102
|
-
console.log("😎 Everything went well, have fun!");
|
|
103
|
-
// eslint-disable-next-line no-undef
|
|
104
|
-
process.exit(0);
|
|
105
|
-
} catch (error) {
|
|
106
|
-
console.log("😬 something went wrong:");
|
|
107
|
-
console.error(error.message);
|
|
108
|
-
// eslint-disable-next-line no-undef
|
|
109
|
-
process.exit(1);
|
|
110
|
-
}
|
|
111
|
-
})();
|
|
File without changes
|
|
File without changes
|