Skip to content

Commit

Permalink
fix: add support for windows (#140)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe authored Jul 14, 2020
1 parent c1c2da1 commit c39773f
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 29 deletions.
18 changes: 10 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
name: ci

on:
- push
- pull_request
push:
branches:
- master
pull_request:
branches:
- master

jobs:
lint:
Expand All @@ -25,7 +29,10 @@ jobs:
run: yarn lint

test:
runs-on: ubuntu-latest
strategy:
matrix:
os: ["ubuntu-latest", "windows-latest"]
runs-on: "${{ matrix.os }}"

steps:
- uses: actions/checkout@v1
Expand All @@ -45,8 +52,3 @@ jobs:

- name: Test project
run: yarn test

- name: Coverage
run: yarn codecov
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
22 changes: 13 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,26 +28,26 @@
"build": "yarn clean && yarn compile",
"watch": "yarn compile -w",
"clean": "rm -rf lib/*",
"compile": "rollup -c",
"clean:fixture": "rm -rf dist/ test/fixture/.nuxt",
"fixture": "yarn nuxt-run dev",
"fixture:prod": "yarn clean:fixture && yarn nuxt-run build && yarn nuxt-run start",
"fixture:generate:export": "yarn clean:fixture && export GENERATE=true && yarn nuxt-run build && PORT=6000 yarn nuxt-run export",
"compile": "rollup -c",
"fixture": "cross-env CMD=dev yarn nuxt-run",
"fixture:prod": "yarn clean:fixture && cross-env CMD=build yarn nuxt-run && cross-env CMD=start yarn nuxt-run",
"fixture:generate:export": "yarn clean:fixture && cross-env GENERATE=true CMD=build yarn nuxt-run && cross-env GENERATE=true PORT=6000 CMD=export yarn nuxt-run",
"fixture:generate": "yarn fixture:generate:export && yarn http-server -s -p 5000 dist",
"lint": "run-s lint:all:*",
"lint:all:eslint": "yarn lint:eslint --ext .js,.ts,.vue .",
"lint:all:prettier": "yarn lint:prettier \"**/*.{js,json,ts,vue}\"",
"lint:eslint": "eslint --fix",
"lint:prettier": "prettier --write --loglevel warn",
"now-build": "NOW_BUILD=true yarn fixture:generate:export",
"nuxt-run": "test/run.sh",
"nuxt-run": "cross-env-shell \"yarn nuxt $CMD -c test/fixture/nuxt.config.js\"",
"prepare": "yarn build",
"prepublishOnly": "yarn lint && yarn test",
"release": "release-it",
"test": "run-s test:*",
"test:e2e-globals": "GLOBALS=true PORT=3000 start-server-and-test fixture:prod 3000 \"testcafe firefox:headless test/e2e\"",
"test:e2e-ssr": "PORT=4000 start-server-and-test fixture:prod 4000 \"testcafe firefox:headless test/e2e\"",
"test:e2e-generated": "GENERATE=true PORT=5000 start-server-and-test fixture:generate 5000 \"testcafe -q firefox:headless test/e2e\"",
"test:e2e-globals": "cross-env GLOBALS=true PORT=3000 start-server-and-test fixture:prod 3000 \"testcafe firefox:headless test/e2e\"",
"test:e2e-ssr": "cross-env PORT=4000 start-server-and-test fixture:prod 4000 \"testcafe firefox:headless test/e2e\"",
"test:e2e-generated": "cross-env GENERATE=true PORT=5000 start-server-and-test fixture:generate 5000 \"testcafe -q firefox:headless test/e2e\"",
"test:types": "tsd",
"test:unit": "jest"
},
Expand All @@ -62,7 +62,8 @@
},
"dependencies": {
"@vue/composition-api": "^0.6.7",
"defu": "^2.0.4"
"defu": "^2.0.4",
"normalize-path": "^3.0.0"
},
"devDependencies": {
"@babel/plugin-transform-runtime": "^7.10.4",
Expand All @@ -72,10 +73,12 @@
"@nuxtjs/module-test-utils": "^1.6.3",
"@release-it/conventional-changelog": "^1.1.4",
"@types/jest": "^26.0.4",
"@types/normalize-path": "^3.0.0",
"@typescript-eslint/eslint-plugin": "^3.6.1",
"@typescript-eslint/parser": "^3.6.1",
"babel-loader": "^8.1.0",
"codecov": "^3.7.0",
"cross-env": "^7.0.2",
"eslint": "^7.4.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-jest": "^23.18.0",
Expand All @@ -93,6 +96,7 @@
"rollup-plugin-copy": "^3.3.0",
"rollup-plugin-dts": "^1.4.8",
"rollup-plugin-typescript2": "^0.27.1",
"shx": "^0.3.2",
"start-server-and-test": "^1.11.2",
"testcafe": "1.8.8",
"tsd": "^0.13.1",
Expand Down
6 changes: 3 additions & 3 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import copy from 'rollup-plugin-copy'
import pkg from './package.json'

export default [
{
input: ['src/index.ts', 'src/entrypoint.ts'],
...['src/index.ts', 'src/entrypoint.ts'].map(input => ({
input,
output: [
{
dir: 'lib',
Expand All @@ -29,7 +29,7 @@ export default [
targets: [{ src: 'src/plugin.js', dest: 'lib' }],
}),
],
},
})),
{
input: 'src/entrypoint.ts',
output: [{ file: 'lib/index.d.ts', format: 'es' }],
Expand Down
13 changes: 10 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
import { resolve, join } from 'path'
import { readdirSync, copyFileSync, existsSync, mkdirpSync } from 'fs-extra'
import {
rmdirSync,
readdirSync,
copyFileSync,
existsSync,
mkdirpSync,
} from 'fs-extra'

import type { Module } from '@nuxt/types'
import normalize from 'normalize-path'

// eslint-disable-next-line
const utils = require('@nuxt/utils')
Expand Down Expand Up @@ -55,8 +62,8 @@ const compositionApiModule: Module<any> = function () {
fileName: join('composition-api', 'index.js'),
options: {
isFullStatic: 'isFullStatic' in utils && utils.isFullStatic(this.options),
staticPath,
publicPath: join(this.options.router?.base || '', '/'),
staticPath: normalize(staticPath),
publicPath: normalize(join(this.options.router?.base || '', '/')),
globalContext,
globalNuxt,
},
Expand Down
3 changes: 0 additions & 3 deletions test/run.sh

This file was deleted.

27 changes: 24 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1936,6 +1936,11 @@
resolved "https://registry.yarnpkg.com/@types/normalize-package-data/-/normalize-package-data-2.4.0.tgz#e486d0d97396d79beedd0a6e33f4534ff6b4973e"
integrity sha512-f5j5b/Gf71L+dbqxIpQ4Z2WlmI/mPJ0fOkGGmFgtb6sAu97EPczzbS3/tJKxmcYDj55OX6ssqwDAWOHIYDRDGA==

"@types/normalize-path@^3.0.0":
version "3.0.0"
resolved "https://registry.yarnpkg.com/@types/normalize-path/-/normalize-path-3.0.0.tgz#bb5c46cab77b93350b4cf8d7ff1153f47189ae31"
integrity sha512-Nd8y/5t/7CRakPYiyPzr/IAfYusy1FkcZYFEAcoMZkwpJv2n4Wm+olW+e7xBdHEXhOnWdG9ddbar0gqZWS4x5Q==

"@types/optimize-css-assets-webpack-plugin@^5.0.1":
version "5.0.1"
resolved "https://registry.yarnpkg.com/@types/optimize-css-assets-webpack-plugin/-/optimize-css-assets-webpack-plugin-5.0.1.tgz#1f437ef9ef937b393687a8819be2d2fddc03b069"
Expand Down Expand Up @@ -5051,6 +5056,13 @@ create-require@^1.0.2:
resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.0.2.tgz#03f97ad0822826e506965f385fd90388f5051624"
integrity sha512-ZizhnQtkxsH1XNsnRy8z2SHRTDAem7fmEJbw1oeuTEkgf5sLXtjrm4nhDcYkO0aiZnAk5dwAze65EvTRaOvxZw==

cross-env@^7.0.2:
version "7.0.2"
resolved "https://registry.yarnpkg.com/cross-env/-/cross-env-7.0.2.tgz#bd5ed31339a93a3418ac4f3ca9ca3403082ae5f9"
integrity sha512-KZP/bMEOJEDCkDQAyRhu3RL2ZO/SUVrxQVI0G3YEQ+OLbRA3c6zgixe8Mq8a/z7+HKlNEjo8oiLUs8iRijY2Rw==
dependencies:
cross-spawn "^7.0.1"

cross-spawn@^5.0.1:
version "5.1.0"
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449"
Expand All @@ -5071,7 +5083,7 @@ cross-spawn@^6.0.0, cross-spawn@^6.0.5:
shebang-command "^1.2.0"
which "^1.2.9"

cross-spawn@^7.0.0, cross-spawn@^7.0.2:
cross-spawn@^7.0.0, cross-spawn@^7.0.1, cross-spawn@^7.0.2:
version "7.0.3"
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6"
integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==
Expand Down Expand Up @@ -5966,7 +5978,7 @@ es-to-primitive@^1.2.1:
is-date-object "^1.0.1"
is-symbol "^1.0.2"

es6-object-assign@^1.1.0:
es6-object-assign@^1.0.3, es6-object-assign@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/es6-object-assign/-/es6-object-assign-1.1.0.tgz#c2c3582656247c39ea107cb1e6652b6f9f24523c"
integrity sha1-wsNYJlYkfDnqEHyx5mUrb58kUjw=
Expand Down Expand Up @@ -12591,7 +12603,7 @@ shell-quote@^1.6.1:
resolved "https://registry.yarnpkg.com/shell-quote/-/shell-quote-1.7.2.tgz#67a7d02c76c9da24f99d20808fcaded0e0e04be2"
integrity sha512-mRz/m/JVscCrkMyPqHc/bczi3OQHkLTqXHEFu0zDhK/qfv3UcOA4SVmRCLmos4bhjr9ekVQubj/R7waKapmiQg==

shelljs@0.8.4, shelljs@^0.8.3:
shelljs@0.8.4, shelljs@^0.8.1, shelljs@^0.8.3:
version "0.8.4"
resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.8.4.tgz#de7684feeb767f8716b326078a8a00875890e3c2"
integrity sha512-7gk3UZ9kOfPLIAbslLzyWeGiEqx9e3rxwZM0KE6EL8GlGwjym9Mrlx5/p33bWTu9YG6vcS4MBxYZDHYr5lr8BQ==
Expand All @@ -12605,6 +12617,15 @@ shellwords@^0.1.1:
resolved "https://registry.yarnpkg.com/shellwords/-/shellwords-0.1.1.tgz#d6b9181c1a48d397324c84871efbcfc73fc0654b"
integrity sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww==

shx@^0.3.2:
version "0.3.2"
resolved "https://registry.yarnpkg.com/shx/-/shx-0.3.2.tgz#40501ce14eb5e0cbcac7ddbd4b325563aad8c123"
integrity sha512-aS0mWtW3T2sHAenrSrip2XGv39O9dXIFUqxAEWHEOS1ePtGIBavdPJY1kE2IHl14V/4iCbUiNDPGdyYTtmhSoA==
dependencies:
es6-object-assign "^1.0.3"
minimist "^1.2.0"
shelljs "^0.8.1"

signal-exit@^3.0.0, signal-exit@^3.0.2, signal-exit@^3.0.3:
version "3.0.3"
resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.3.tgz#a1410c2edd8f077b08b4e253c8eacfcaf057461c"
Expand Down

1 comment on commit c39773f

@vercel
Copy link

@vercel vercel bot commented on c39773f Jul 14, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.