漫画の新刊通知してもらうためにベルアラートから amakan に移住するために amakankan にベルアラート対応の Pull Request を送った
移住にあたってデータを移す必要がある。 幸い amakan には amakankan という色んなサイトからデータを移す Chrome 拡張がある。 ので、ベルアラート対応を機能追加してみた。
amakankan の作者さんに Docker で npm build
できる環境を整えてもらった。
@_tyru_ amakankanのリポジトリ少し更新して、Dockerでビルドしたり出来るようにしておきました
— ホームページビルダー (@r7kamura) 2017年1月23日
というわけで Docker for Windows でも動かしてみたけどうまく動かなかった。
まず、Windows の MAX_PATH
制限により docker-compose up
が失敗した。
- building local dockerfile from compose, hits windows max path length error · Issue #2473 · docker/compose · GitHub
- node.js - Windows Error : Source Path Too Long - Stack Overflow
- Too many dependencies break the Windows file system · Issue #3697 · npm/npm · GitHub
npm を upgrade したら docker-compose up
は動くようになった。
To upgrade, run: [sudo] npm install npm@latest -g
「docker-compose run –rm node yarn run build」の出力を開くにはクリック
>docker-compose run --rm node yarn run build Building node Step 1/7 : FROM node:6.9.4 6.9.4: Pulling from library/node 5040bd298390: Pull complete fce5728aad85: Pull complete 76610ec20bf5: Pull complete 52f3db4b5710: Pull complete 7e5867712a67: Pull complete 563b602246dd: Pull complete e36be4a7cd92: Pull complete Digest: sha256:3b7500b6a4e8df9ab313ee0a0c6901a8d47c836aeda4eacda1d8a8f8d02789b3 Status: Downloaded newer image for node:6.9.4 ---> c5667be18e4e Step 2/7 : ENV PATH /root/.yarn/bin:$PATH ---> Running in 963944a3d244 ---> 449d75a21987 Removing intermediate container 963944a3d244 Step 3/7 : RUN curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 0.18.1 ---> Running in 5a740415731b % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 6742 0 6742 0 0 17784 0 --:--:-- --:--:-- --:--:-- 17742 Installing Yarn! > Downloading tarball... [1/2]: https://yarnpkg.com/downloads/0.18.1/yarn-v0.18.1.tar.gz --> /tmp/yarn.tar.gz.OCCR4WDbVq % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 92 100 92 0 0 460 0 --:--:-- --:--:-- --:--:-- 462 100 595 0 595 0 0 555 0 --:--:-- 0:00:01 --:--:-- 116k 100 3537k 100 3537k 0 0 571k 0 0:00:06 0:00:06 --:--:-- 822k [2/2]: https://yarnpkg.com/downloads/0.18.1/yarn-v0.18.1.tar.gz.asc --> /tmp/yarn.tar.gz.OCCR4WDbVq.asc 100 96 100 96 0 0 435 0 --:--:-- --:--:-- --:--:-- 435 100 600 0 600 0 0 1337 0 --:--:-- --:--:-- --:--:-- 1337 100 832 100 832 0 0 1285 0 --:--:-- --:--:-- --:--:-- 1285 > Verifying integrity... gpg: key 86E50310: public key "Yarn Packaging" imported gpg: Total number processed: 1 gpg: imported: 1 (RSA: 1) gpg: Signature made Sat Dec 17 12:30:28 2016 UTC using RSA key ID FD2497F5 gpg: Good signature from "Yarn Packaging " gpg: WARNING: This key is not certified with a trusted signature! gpg: There is no indication that the signature belongs to the owner. Primary key fingerprint: 72EC F46A 56B4 AD39 C907 BBB7 1646 B01B 86E5 0310 Subkey fingerprint: 6A01 0C51 6600 6599 AA17 F081 46C2 130D FD24 97F5 > GPG signature looks good > Extracting to ~/.yarn... > Adding to $PATH... > We've added the following to your /root/.bashrc > If this isn't the profile of your current shell then please add the following to your correct profile: export PATH="$HOME/.yarn/bin:$PATH" > Successfully installed Yarn 0.18.1! Please open another terminal where the `yarn` command will now be available. ---> 37db72ea0feb Removing intermediate container 5a740415731b Step 4/7 : WORKDIR /app ---> bf6d466b1086 Removing intermediate container 2ca65d1b34d8 Step 5/7 : COPY package.json yarn.lock /app/ ---> ddb3b8f26274 Removing intermediate container 857df68ff672 Step 6/7 : RUN yarn install ---> Running in 42c12682e198 yarn install v0.18.1 [1/4] Resolving packages... warning watch@0.19.3: Install watch@1.0.0 instead [2/4] Fetching packages... info "fsevents@1.0.17" is an optional dependency and failed compatibility check. Excluding it from installation. warning fsevents@1.0.17: The platform "linux" is incompatible with this module. [3/4] Linking dependencies... [4/4] Building fresh packages... success Saved lockfile. Done in 19.33s. ---> 54be0115796c Removing intermediate container 42c12682e198 Step 7/7 : COPY . /app ---> e6f4feeb4f3b Removing intermediate container fc84e958a493 Successfully built e6f4feeb4f3b WARNING: Image for service node was built because it did not already exist. To rebuild this image you must use `docker-compose build` or `docker-compose up --build`. ERROR: Cannot create container for service node: C: drive is not shared. Please share it in Docker for Windows Settings
C: drive is not shared
とのことなので C ドライブを共有してみる。
これで無事ビルドできるようになった。
ちなみに docker-compose up
で watch できるようにもしてくれているが、こちらもちゃんと動いた。
ただ .crx ファイルを作ろうとしたが、zip
コマンドを実行しようとしているらしく Windows では動かなかった。
「docker-compose run –rm node yarn run pack」の出力を開くにはクリック
C:\msys64\home\tyru\git\amakankan>docker-compose run --rm node yarn run pack yarn run v0.18.1 $ npm run build && npm run pack:firefox && npm run pack:chrome npm info it worked if it ends with ok npm info using npm@3.10.10 npm info using node@v6.9.4 npm info lifecycle amakankan@~prebuild: amakankan@ npm info lifecycle amakankan@~build: amakankan@ > amakankan@ build /app > npm run build:rm && npm run build:mkdir && npm run build:cp && npm run build:js npm info it worked if it ends with ok npm info using npm@3.10.10 npm info using node@v6.9.4 npm info lifecycle amakankan@~prebuild:rm: amakankan@ npm info lifecycle amakankan@~build:rm: amakankan@ > amakankan@ build:rm /app > rm -rf dist/* || 0 npm info lifecycle amakankan@~postbuild:rm: amakankan@ npm info ok npm info it worked if it ends with ok npm info using npm@3.10.10 npm info using node@v6.9.4 npm info lifecycle amakankan@~prebuild:mkdir: amakankan@ npm info lifecycle amakankan@~build:mkdir: amakankan@ > amakankan@ build:mkdir /app > mkdir -p dist/chrome/js && mkdir -p dist/chrome/images npm info lifecycle amakankan@~postbuild:mkdir: amakankan@ npm info ok npm info it worked if it ends with ok npm info using npm@3.10.10 npm info using node@v6.9.4 npm info lifecycle amakankan@~prebuild:cp: amakankan@ npm info lifecycle amakankan@~build:cp: amakankan@ > amakankan@ build:cp /app > cp src/chrome/manifest.json dist/chrome/manifest.json && cp src/chrome/images/* dist/chrome/images npm info lifecycle amakankan@~postbuild:cp: amakankan@ npm info ok npm info it worked if it ends with ok npm info using npm@3.10.10 npm info using node@v6.9.4 npm info lifecycle amakankan@~prebuild:js: amakankan@ npm info lifecycle amakankan@~build:js: amakankan@ > amakankan@ build:js /app > npm run build:js:amazon && npm run build:js:background && npm run build:js:booklog && npm run build:js:bookmeter && npm run build:js:tsutaya-log && npm run build:js:bell-alert npm info it worked if it ends with ok npm info using npm@3.10.10 npm info using node@v6.9.4 npm info lifecycle amakankan@~prebuild:js:amazon: amakankan@ npm info lifecycle amakankan@~build:js:amazon: amakankan@ > amakankan@ build:js:amazon /app > browserify src/chrome/js/content-script-amazon.js -t babelify -o dist/chrome/js/content-script-amazon.js npm info lifecycle amakankan@~postbuild:js:amazon: amakankan@ npm info ok npm info it worked if it ends with ok npm info using npm@3.10.10 npm info using node@v6.9.4 npm info lifecycle amakankan@~prebuild:js:background: amakankan@ npm info lifecycle amakankan@~build:js:background: amakankan@ > amakankan@ build:js:background /app > browserify src/chrome/js/background.js -t babelify -o dist/chrome/js/background.js npm info lifecycle amakankan@~postbuild:js:background: amakankan@ npm info ok npm info it worked if it ends with ok npm info using npm@3.10.10 npm info using node@v6.9.4 npm info lifecycle amakankan@~prebuild:js:booklog: amakankan@ npm info lifecycle amakankan@~build:js:booklog: amakankan@ > amakankan@ build:js:booklog /app > browserify src/chrome/js/content-script-booklog.js -t babelify -o dist/chrome/js/content-script-booklog.js npm info lifecycle amakankan@~postbuild:js:booklog: amakankan@ npm info ok npm info it worked if it ends with ok npm info using npm@3.10.10 npm info using node@v6.9.4 npm info lifecycle amakankan@~prebuild:js:bookmeter: amakankan@ npm info lifecycle amakankan@~build:js:bookmeter: amakankan@ > amakankan@ build:js:bookmeter /app > browserify src/chrome/js/content-script-bookmeter.js -t babelify -o dist/chrome/js/content-script-bookmeter.js npm info lifecycle amakankan@~postbuild:js:bookmeter: amakankan@ npm info ok npm info it worked if it ends with ok npm info using npm@3.10.10 npm info using node@v6.9.4 npm info lifecycle amakankan@~prebuild:js:tsutaya-log: amakankan@ npm info lifecycle amakankan@~build:js:tsutaya-log: amakankan@ > amakankan@ build:js:tsutaya-log /app > browserify src/chrome/js/content-script-tsutaya-log.js -t babelify -o dist/chrome/js/content-script-tsutaya-log.js npm info lifecycle amakankan@~postbuild:js:tsutaya-log: amakankan@ npm info ok npm info it worked if it ends with ok npm info using npm@3.10.10 npm info using node@v6.9.4 npm info lifecycle amakankan@~prebuild:js:bell-alert: amakankan@ npm info lifecycle amakankan@~build:js:bell-alert: amakankan@ > amakankan@ build:js:bell-alert /app > browserify src/chrome/js/content-script-bell-alert.js -t babelify -o dist/chrome/js/content-script-bell-alert.js npm info lifecycle amakankan@~postbuild:js:bell-alert: amakankan@ npm info ok npm info lifecycle amakankan@~postbuild:js: amakankan@ npm info ok npm info lifecycle amakankan@~postbuild: amakankan@ npm info ok npm info it worked if it ends with ok npm info using npm@3.10.10 npm info using node@v6.9.4 npm info lifecycle amakankan@~prepack:firefox: amakankan@ npm info lifecycle amakankan@~pack:firefox: amakankan@ > amakankan@ pack:firefox /app > cp -r dist/chrome dist/firefox && cd dist/firefox && zip -r ../amakankan-firefox.zip images js manifest.json sh: 1: zip: not found npm info lifecycle amakankan@~pack:firefox: Failed to exec pack:firefox script npm ERR! Linux 4.9.4-moby npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "pack:firefox" npm ERR! node v6.9.4 npm ERR! npm v3.10.10 npm ERR! file sh npm ERR! code ELIFECYCLE npm ERR! errno ENOENT npm ERR! syscall spawn npm ERR! amakankan@ pack:firefox: `cp -r dist/chrome dist/firefox && cd dist/firefox && zip -r ../amakankan-firefox.zip images js manifest.json` npm ERR! spawn ENOENT npm ERR! npm ERR! Failed at the amakankan@ pack:firefox script 'cp -r dist/chrome dist/firefox && cd dist/firefox && zip -r ../amakankan-firefox.zip images js manifest.json'. npm ERR! Make sure you have the latest version of node.js and npm installed. npm ERR! If you do, this is most likely a problem with the amakankan package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! cp -r dist/chrome dist/firefox && cd dist/firefox && zip -r ../amakankan-firefox.zip images js manifest.json npm ERR! You can get information on how to open an issue for this project with: npm ERR! npm bugs amakankan npm ERR! Or if that isn't available, you can get their info via: npm ERR! npm owner ls amakankan npm ERR! There is likely additional logging output above. npm ERR! Please include the following file with any support request: npm ERR! /app/npm-debug.log error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
まぁリポジトリのファイルパスを指定すれば使えるし、git pull
すれば最新が降ってくるので特に .crx ファイルを作らなくても開発はできる。
のだけど、せっかくだしあとで Windows 対応もやってみようかな。