$ docker pull verdaccio/verdaccio:nightly-master
$ docker run -it-p4873:4873 --rm verdaccio/verdaccio:nightly-master
(node:8)[DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
info -=- local storage path /verdaccio/storage/data/.verdaccio-db.json
info -=- no private database found, recreating new one on /verdaccio/storage/data/.verdaccio-db.json
info --- using htpasswd file: /verdaccio/storage/htpasswd
info --- http address http://0.0.0.0:4873/
info --- version: 7.0.0-next-7.13
info --- server started
$ npm -w packages/core run changeset [branch:main](untracked)[~/project/example-monorepo]> @example-monorepo/core@0.0.0 changeset
> changeset
🦋 Which packages would you like to include? · @example-monorepo/core, @example-monorepo/express
🦋 Which packages should have a major bump? · No items were selected
🦋 Which packages should have a minor bump? · No items were selected
🦋 The following packages will be patch bumped:
🦋 @example-monorepo/core@0.0.0
🦋 @example-monorepo/express@0.0.0
🦋 Please enter a summary for this change (this will be in the changelogs).
🦋 (submit empty line to open external editor)
🦋 Summary · the first update
🦋
🦋 === Summary of changesets ===
🦋 patch: @example-monorepo/core, @example-monorepo/express
🦋
🦋 Note: All dependents of these packages that will be incompatible with
🦋 the new version will be patch bumped when this changeset is applied.
🦋
🦋 Is this your desired changeset? (Y/n) · true
🦋 Changeset added! - you can now commit it
🦋
🦋 If you want to modify or expand on the changeset summary, you can find it here
$ npm run publish
> example-monorepo@0.0.0 publish
> turbo run publish
• Packages in scope: @example-monorepo/core, @example-monorepo/dev-config, @example-monorepo/express
• Running publish in3 packages
• Remote caching disabled
@example-monorepo/express:publish: cache bypass, force executing 95f6040856482a97
@example-monorepo/core:publish: cache bypass, force executing 304ea4a437f8c0b8
@example-monorepo/express:publish:
@example-monorepo/express:publish: > @example-monorepo/express@0.0.1 publish
@example-monorepo/express:publish: > changeset publish
@example-monorepo/express:publish:
@example-monorepo/core:publish:
@example-monorepo/core:publish: > @example-monorepo/core@0.0.1 publish
@example-monorepo/core:publish: > changeset publish
@example-monorepo/core:publish:
@example-monorepo/express:publish: 🦋 info npm info @example-monorepo/core
@example-monorepo/core:publish: 🦋 info npm info @example-monorepo/core
@example-monorepo/core:publish: 🦋 info npm info @example-monorepo/express
@example-monorepo/express:publish: 🦋 info npm info @example-monorepo/express
@example-monorepo/core:publish: 🦋 warn Received 404for npm info "@example-monorepo/core"
@example-monorepo/express:publish: 🦋 warn Received 404for npm info "@example-monorepo/express"
@example-monorepo/express:publish: 🦋 warn Received 404for npm info "@example-monorepo/core"
@example-monorepo/express:publish: 🦋 info @example-monorepo/core is being published because our local version (0.0.1) has not been published on npm
@example-monorepo/express:publish: 🦋 info @example-monorepo/express is being published because our local version (0.0.1) has not been published on npm
@example-monorepo/express:publish: 🦋 info Publishing "@example-monorepo/core" at "0.0.1"
@example-monorepo/express:publish: 🦋 info Publishing "@example-monorepo/express" at "0.0.1"
@example-monorepo/core:publish: 🦋 warn Received 404for npm info "@example-monorepo/express"
@example-monorepo/core:publish: 🦋 info @example-monorepo/core is being published because our local version (0.0.1) has not been published on npm
@example-monorepo/core:publish: 🦋 info @example-monorepo/express is being published because our local version (0.0.1) has not been published on npm
@example-monorepo/core:publish: 🦋 info Publishing "@example-monorepo/core" at "0.0.1"
@example-monorepo/core:publish: 🦋 info Publishing "@example-monorepo/express" at "0.0.1"
@example-monorepo/core:publish: 🦋 error an error occurred while publishing @example-monorepo/express: E409 409 Conflict - PUT http://0.0.0.0:4873/@example-monorepo%2fcore - this package is already present @example-monorepo/express:publish: 🦋 error an error occurred while publishing @example-monorepo/express: E409 409 Conflict - PUT http://0.0.0.0:4873/@example-monorepo%2fexpress - this package is already present @example-monorepo/core:publish: 🦋 error npm notice Publishing to http://0.0.0.0:4873 with tag latest and public access@example-monorepo/core:publish: 🦋 error npm ERR! code E409@example-monorepo/core:publish: 🦋 error npm ERR! 409 Conflict - PUT http://0.0.0.0:4873/@example-monorepo%2fcore - this package is already present@example-monorepo/core:publish: 🦋 error @example-monorepo/core:publish: 🦋 error @example-monorepo/express:publish: 🦋 error npm notice Publishing to http://0.0.0.0:4873 with tag latest and public access@example-monorepo/express:publish: 🦋 error npm ERR! code E409@example-monorepo/express:publish: 🦋 error npm ERR! 409 Conflict - PUT http://0.0.0.0:4873/@example-monorepo%2fexpress - this package is already present@example-monorepo/express:publish: 🦋 error @example-monorepo/express:publish: 🦋 error @example-monorepo/express:publish: 🦋 success packages published successfully:@example-monorepo/core:publish: 🦋 success packages published successfully:@example-monorepo/express:publish: 🦋 @example-monorepo/core@0.0.1@example-monorepo/express:publish: 🦋 Creating git tag...@example-monorepo/core:publish: 🦋 @example-monorepo/core@0.0.1@example-monorepo/core:publish: 🦋 Creating git tag...@example-monorepo/express:publish: 🦋 New tag: @example-monorepo/core@0.0.1@example-monorepo/core:publish: 🦋 New tag: @example-monorepo/core@0.0.1@example-monorepo/core:publish: 🦋 error packages failed to publish:@example-monorepo/core:publish: 🦋 @example-monorepo/express@0.0.1@example-monorepo/express:publish: 🦋 error packages failed to publish:@example-monorepo/express:publish: 🦋 @example-monorepo/express@0.0.1
$ npm install -D @changesets/cli
$ npm run changeset init
$ npm run changeset
$ npm run changeset version
$ npm run changeset publish
> example-monorepo@0.0.0 publish
> changeset publish
🦋 info npm info @example-monorepo/core
🦋 info npm info @example-monorepo/express
🦋 info @example-monorepo/core is being published because our local version (0.0.2) has not been published on npm
🦋 info @example-monorepo/express is being published because our local version (0.0.2) has not been published on npm
🦋 info Publishing "@example-monorepo/core" at "0.0.2"
🦋 info Publishing "@example-monorepo/express" at "0.0.2"
🦋 success packages published successfully:
🦋 @example-monorepo/core@0.0.2
🦋 @example-monorepo/express@0.0.2
🦋 Creating git tags...
🦋 New tag: @example-monorepo/core@0.0.2
🦋 New tag: @example-monorepo/express@0.0.2
> nest new apis
⚡ We will scaffold your app in a few seconds..
CREATE /apis/.prettierrc (51 bytes)
CREATE /apis/README.md (3370 bytes)
CREATE /apis/nest-cli.json (64 bytes)
CREATE /apis/package.json (1687 bytes)
CREATE /apis/tsconfig.build.json (97 bytes)
CREATE /apis/tsconfig.json (336 bytes)
CREATE /apis/tslint.json (426 bytes)
CREATE /apis/src/app.controller.spec.ts (617 bytes)
CREATE /apis/src/app.controller.ts (274 bytes)
CREATE /apis/src/app.module.ts (249 bytes)
CREATE /apis/src/app.service.ts (142 bytes)
CREATE /apis/src/main.ts (208 bytes)
CREATE /apis/test/app.e2e-spec.ts (630 bytes)
CREATE /apis/test/jest-e2e.json (183 bytes)
? Which package manager would you ❤️ to use? npm
✔ Installation in progress... ☕
🚀 Successfully created project apis
👉 Get started with the following commands:
$ cd apis
$ npm run start
Thanks for installing Nest 🙏
Please consider donating to our open collective
to help us maintain this package.
🍷 Donate: https://opencollective.com/nest
> gcloud app deploy
Services to deploy:
descriptor: [/Users/mizuki/workspace/20191203-example-appengine/apis/app.yaml]
source: [/Users/mizuki/workspace/20191203-example-appengine/apis]
target project: [astral-web-260712]
target service: [apis]
target version: [20191203t232045]
target url: [https://apis-dot-astral-web-260712.appspot.com]
Do you want to continue (Y/n)? y
Beginning deployment of service [apis]...
Created .gcloudignore file. See `gcloud topic gcloudignore` for details.
╔════════════════════════════════════════════════════════════╗
╠═ Uploading 29 files to Google Cloud Storage ═╣
╚════════════════════════════════════════════════════════════╝
File upload done.
Updating service [apis]...done.
Setting traffic split for service [apis]...done.
Deployed service [apis] to [https://apis-dot-astral-web-260712.appspot.com]
You can stream logs from the command line by running:
$ gcloud app logs tail -s apis
To view your application in the web browser run:
$ gcloud app browse -s apis
さー、デプロイできたぞー、と思ったがーー
> curl https://apis-dot-astral-web-260712.appspot.com
<html><head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>500 Server Error</title>
</head>
<body text=#000000 bgcolor=#ffffff>
<h1>Error: Server Error</h1>
<h2>The server encountered an error and could not complete your request.<p>Please try again in 30 seconds.</h2>
<h2></h2>
</body></html>
ーーなんかエラーになるな...
困ったときはとりあえずログを確認。-sでサービスを指定する。
> gcloud app logs tail -s apis
Waiting for new log entries...
2019-12-03 14:22:46 apis[20191203t232045] "GET / HTTP/1.1" 500
2019-12-03 14:22:46 apis[20191203t232045] sh: 1: exec: nest: not found
2019-12-03 14:22:48 apis[20191203t232045] "GET /favicon.ico HTTP/1.1" 500
2019-12-03 14:22:49 apis[20191203t232045] sh: 1: exec: nest: not found
2019-12-03 14:22:52 apis[20191203t232045] "GET / HTTP/1.1" 500
2019-12-03 14:22:52 apis[20191203t232045] sh: 1: exec: nest: not found
2019-12-03 14:22:52 apis[20191203t232045] "GET /favicon.ico HTTP/1.1" 500
2019-12-03 14:22:53 apis[20191203t232045] sh: 1: exec: nest: not found
2019-12-03 14:23:22 apis[20191203t232045] "GET / HTTP/1.1" 500
2019-12-03 14:23:22 apis[20191203t232045] sh: 1: exec: nest: not found
nest not foundらしい...
@nestjs/cliがdevDependenciesに含まれているため、インストールされないようだ。
> gcloud app deploy
Services to deploy:
descriptor: [/Users/mizuki/workspace/20191203-example-appengine/apis/app.yaml]
source: [/Users/mizuki/workspace/20191203-example-appengine/apis]
target project: [astral-web-260712]
target service: [apis]
target version: [20191203t233112]
target url: [https://apis-dot-astral-web-260712.appspot.com]
Do you want to continue (Y/n)? y
Beginning deployment of service [apis]...
╔════════════════════════════════════════════════════════════╗
╠═ Uploading 1 file to Google Cloud Storage ═╣
╚════════════════════════════════════════════════════════════╝
File upload done.
Updating service [apis]...done.
Setting traffic split for service [apis]...done.
Deployed service [apis] to [https://apis-dot-astral-web-260712.appspot.com]
You can stream logs from the command line by running:
$ gcloud app logs tail -s apis
To view your application in the web browser run:
$ gcloud app browse -s apis
> cat app.yaml
# Copyright 2017, Google, Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# [START gae_quickstart_yaml]
runtime: nodejs10
# [END gae_quickstart_yaml]
次は実行する app.js の中身。
至って普通のExpressのアプリだが、const PORT = process.env.PORT || 8080でポートを環境変数から受け取れるようにしている。
AppEngineはPORTを指定して起動するので、環境変数から受け取れるようにしないとサービスの疎通ができないのだ。
> cat app.js
// Copyright 2017 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
'use strict';
// [START gae_node_request_example]
const express = require('express');
const app = express();
app.get('/', (req, res) => {
res
.status(200)
.send('Hello, world!')
.end();
});
// Start the server
const PORT = process.env.PORT || 8080;
app.listen(PORT, () => {
console.log(`App listening on port ${PORT}`);
console.log('Press Ctrl+C to quit.');
});
// [END gae_node_request_example]
module.exports = app;
> gcloud app deploy
Services to deploy:
descriptor: [/Users/mizuki/workspace/20191201-example-appengine/nodejs-docs-samples/appengine/hello-world/standard/app.yaml]
source: [/Users/mizuki/workspace/20191201-example-appengine/nodejs-docs-samples/appengine/hello-world/standard]
target project: [astral-web-260712]
target service: [default]
target version: [20191201t220456]
target url: [https://astral-web-260712.appspot.com]
Do you want to continue (Y/n)?
プロジェクトやソースが適切なのを確認する。
問題ないので、yを押してEnter。
Do you want to continue (Y/n)? y
Beginning deployment of service [default]...
Created .gcloudignore file. See `gcloud topic gcloudignore` for details.
╔════════════════════════════════════════════════════════════╗
╠═ Uploading 6 files to Google Cloud Storage ═╣
╚════════════════════════════════════════════════════════════╝
File upload done.
Updating service [default]...⠧
deploy中...
暫く待つ。
暫く待つと、deploy結果が出てくる。
File upload done.
Updating service [default]...done.
Setting traffic split for service [default]...done.
Deployed service [default] to [https://astral-web-260712.appspot.com]
You can stream logs from the command line by running:
$ gcloud app logs tail -s default
To view your application in the web browser run:
$ gcloud app browse