-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathdeprecate.js
49 lines (45 loc) · 1.24 KB
/
deprecate.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/* eslint-disable no-console */
const childProcess = require('child_process')
// check arguments
const version = process.argv[2]
if (!version) {
throw new Error('version not given in argv')
}
if (!/[0-9]+\.[0-9]+\.[0-9]+/.test(version)) {
throw new Error('version illegal')
}
const message = process.argv[3]
if (!message) {
throw new Error('message not given in argv')
}
// npm deprecate
;[
'glass-easel-template-compiler',
'glass-easel-stylesheet-compiler',
'glass-easel',
'glass-easel-miniprogram-adapter',
'glass-easel-miniprogram-webpack-plugin',
'glass-easel-miniprogram-template',
].forEach((p) => {
console.info(`Deprecate ${p}@${version} on npmjs`)
if (
childProcess.spawnSync(
'npm',
['deprecate', `${p}@${version}`, message, '--registry', 'https://registry.npmjs.org'],
{ stdio: 'inherit' },
).status !== 0
) {
throw new Error('failed to deprecate')
}
})
// cargo yank
;['glass-easel-template-compiler', 'glass-easel-stylesheet-compiler'].forEach((p) => {
console.info(`Deprecate ${p}@${version} on crates.io`)
if (
childProcess.spawnSync('cargo', ['yank', '--version', `${version}`, `${p}`], {
stdio: 'inherit',
}).status !== 0
) {
throw new Error('failed to deprecate')
}
})