|
1 | 1 | set -e
|
2 | 2 |
|
3 |
| -if [[ -z $1 ]]; then |
4 |
| - echo "Enter new version: " |
5 |
| - read VERSION |
| 3 | +# check if np is installed |
| 4 | +# if not, prompt the user to install it |
| 5 | +np_version=$(np --version) |
| 6 | +if [[ $? -eq 0 ]]; then |
| 7 | + echo "Using np version: " $np_version |
6 | 8 | else
|
7 |
| - VERSION=$1 |
| 9 | + echo "np is not installed" |
| 10 | + read -e -p "Install globally? (Executes: npm install -global np) [y/n]" REPLY |
| 11 | + if [[ $REPLY =~ ^(y|yes)$ ]]; then |
| 12 | + npm install -global np |
| 13 | + elif [[ $REPLY =~ ^(n|no)$ ]]; then |
| 14 | + echo "Exiting..." |
| 15 | + exit 1 |
| 16 | + fi |
| 17 | +fi |
| 18 | + |
| 19 | +# get the version number from the user |
| 20 | +read -e -p "Enter the new version" VERSION |
| 21 | +if [[ -z $VERSION ]]; then |
| 22 | + echo "No version entered. Exiting..." |
| 23 | + exit 0 |
8 | 24 | fi
|
9 | 25 |
|
10 | 26 | read -p "Releasing $VERSION - are you sure? (y/n) " -n 1 -r
|
11 | 27 | echo
|
12 | 28 | if [[ $REPLY =~ ^[Yy]$ ]]; then
|
13 | 29 | echo "Releasing $VERSION ..."
|
14 | 30 |
|
15 |
| - npm run lint |
16 |
| - npm run flow |
17 |
| - npm run test:cover |
18 |
| - npm run test:e2e |
19 |
| - npm run test:ssr |
| 31 | + # bump package versions |
| 32 | + # packages: |
| 33 | + # - vue-native-core |
| 34 | + # - vue-native-helper |
| 35 | + # - vue-native-scripts |
| 36 | + # - vue-native-template-compiler |
20 | 37 |
|
21 |
| - if [[ -z $SKIP_SAUCE ]]; then |
22 |
| - export SAUCE_BUILD_ID=$VERSION:`date +"%s"` |
23 |
| - npm run test:sauce |
24 |
| - fi |
| 38 | + cd packages/vue-native-core |
| 39 | + npm version $VERSION |
| 40 | + cd - |
25 | 41 |
|
26 |
| - # build |
27 |
| - VERSION=$VERSION npm run build |
| 42 | + cd packages/vue-native-helper |
| 43 | + npm version $VERSION |
| 44 | + cd - |
28 | 45 |
|
29 |
| - # update packages |
30 |
| - cd packages/vue-template-compiler |
| 46 | + cd packages/vue-native-scripts |
31 | 47 | npm version $VERSION
|
32 |
| - if [[ -z $RELEASE_TAG ]]; then |
33 |
| - npm publish |
34 |
| - else |
35 |
| - npm publish --tag $RELEASE_TAG |
36 |
| - fi |
37 | 48 | cd -
|
38 | 49 |
|
39 |
| - cd packages/vue-server-renderer |
| 50 | + cd packages/vue-native-template-compiler |
40 | 51 | npm version $VERSION
|
41 |
| - if [[ -z $RELEASE_TAG ]]; then |
42 |
| - npm publish |
43 |
| - else |
44 |
| - npm publish --tag $RELEASE_TAG |
45 |
| - fi |
46 | 52 | cd -
|
47 | 53 |
|
| 54 | + # build |
| 55 | + # the build needs to be generated after the version bump |
| 56 | + # because the Vue version comes from packages/vue-native-core/package.json |
| 57 | + # refer to build/config.js |
| 58 | + VERSION=$VERSION npm run build |
| 59 | + |
48 | 60 | # commit
|
49 | 61 | git add -A
|
50 | 62 | git commit -m "[build] $VERSION"
|
51 |
| - npm version $VERSION --message "[release] $VERSION" |
52 |
| - |
53 |
| - # publish |
54 |
| - git push origin refs/tags/v$VERSION |
55 |
| - git push |
56 |
| - if [[ -z $RELEASE_TAG ]]; then |
57 |
| - npm publish |
58 |
| - else |
59 |
| - npm publish --tag $RELEASE_TAG |
60 |
| - fi |
| 63 | + |
| 64 | + # use np to create release with VERSION and publish vue-native-core |
| 65 | + # you MUST be in the master branch to do this |
| 66 | + # if it fails, then the last commit is reset and the script exits |
| 67 | + # TODO: add tests and remove --yolo |
| 68 | + np --no-yarn --contents packages/vue-native-core --yolo $VERSION || { git reset --soft HEAD~1; exit 1; } |
| 69 | + |
| 70 | + # publish packages |
| 71 | + # vue-native-core has already been published by np |
| 72 | + # packages: |
| 73 | + # - vue-native-helper |
| 74 | + # - vue-native-scripts |
| 75 | + # - vue-native-template-compiler |
| 76 | + |
| 77 | + cd packages/vue-native-helper |
| 78 | + npm publish |
| 79 | + cd - |
| 80 | + |
| 81 | + cd packages/vue-native-scripts |
| 82 | + npm publish |
| 83 | + cd - |
| 84 | + |
| 85 | + cd packages/vue-native-template-compiler |
| 86 | + npm publish |
| 87 | + cd - |
| 88 | + |
61 | 89 | fi
|
0 commit comments