Enable Windows tests (#1712)
This commit is contained in:
parent
758c712f01
commit
c0d9ed832e
8 changed files with 366 additions and 358 deletions
24
.github/workflows/ci.yml
vendored
24
.github/workflows/ci.yml
vendored
|
@ -18,19 +18,18 @@ jobs:
|
|||
matrix:
|
||||
os: [ubuntu-latest]
|
||||
node_version: [12, 14, 16]
|
||||
# TODO: uncomment this (Vite has trouble resolving imports on Windows)
|
||||
# include:
|
||||
# - os: windows-latest
|
||||
# node_version: 14
|
||||
include:
|
||||
- os: windows-latest
|
||||
node_version: 16
|
||||
fail-fast: false
|
||||
env:
|
||||
LANG: en-us
|
||||
name: 'Test: node-${{ matrix.node_version }}, ${{ matrix.os }}'
|
||||
steps:
|
||||
- name: Checkout
|
||||
- name: Check out code using Git
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Set node version to ${{ matrix.node_version }}
|
||||
- name: Set Node version to ${{ matrix.node_version }}
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: ${{ matrix.node_version }}
|
||||
|
@ -50,16 +49,16 @@ jobs:
|
|||
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
name: 'Lint: node-14, ubuntu-latest'
|
||||
name: 'Lint: node-16, ubuntu-latest'
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set node version to 14
|
||||
- name: Set Node version to 16
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 14
|
||||
node-version: 16
|
||||
cache: 'yarn'
|
||||
|
||||
- name: Debug
|
||||
|
@ -79,14 +78,15 @@ jobs:
|
|||
# runs-on: ubuntu-latest
|
||||
# name: 'Smoke: node-14, ubuntu-latest'
|
||||
# steps:
|
||||
# - uses: actions/checkout@v2
|
||||
# - name: Check out code using Git
|
||||
# uses: actions/checkout@v2
|
||||
# with:
|
||||
# fetch-depth: 0
|
||||
|
||||
# - name: Set node version to 14
|
||||
# - name: Set Node version to 16
|
||||
# uses: actions/setup-node@v2
|
||||
# with:
|
||||
# node-version: 14
|
||||
# node-version: 16
|
||||
# cache: 'yarn'
|
||||
|
||||
# - name: Debug
|
||||
|
|
18
.github/workflows/format.yml
vendored
18
.github/workflows/format.yml
vendored
|
@ -5,24 +5,26 @@ on:
|
|||
branches:
|
||||
- main
|
||||
|
||||
env:
|
||||
node_version: 14
|
||||
|
||||
jobs:
|
||||
format:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Check out code using Git
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
ref: ${{ github.head_ref }}
|
||||
- uses: actions/setup-node@v2
|
||||
- name: Set Node version to 16
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: ${{ env.node_version }}
|
||||
- run: yarn --frozen-lockfile --ignore-engines
|
||||
node-version: 16
|
||||
cache: 'yarn'
|
||||
- name: Install dependencies
|
||||
run: yarn --frozen-lockfile --ignore-engines
|
||||
env:
|
||||
CI: true
|
||||
- run: yarn lerna run build --scope @astrojs/parser
|
||||
- run: yarn format
|
||||
- name: Format code
|
||||
run: yarn format
|
||||
- name: Commit changes
|
||||
uses: stefanzweifel/git-auto-commit-action@v4
|
||||
with:
|
||||
|
|
5
.github/workflows/release.yml
vendored
5
.github/workflows/release.yml
vendored
|
@ -10,15 +10,16 @@ jobs:
|
|||
name: Changelog
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out branch
|
||||
- name: Check out code using Git
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0 # This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
|
||||
|
||||
- name: Set up Node.js 14.x
|
||||
- name: Set Node version to 14
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 14.x
|
||||
cache: 'yarn'
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn --frozen-lockfile --ignore-engines
|
||||
|
|
20
.github/workflows/stat.yml
vendored
20
.github/workflows/stat.yml
vendored
|
@ -5,22 +5,22 @@ on:
|
|||
# * is a special character in YAML so you have to quote this string
|
||||
- cron: '0 12 * * *'
|
||||
|
||||
env:
|
||||
node_version: 14
|
||||
|
||||
jobs:
|
||||
stat:
|
||||
if: github.repository == 'snowpackjs/astro'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
# Check out code using git
|
||||
- uses: actions/checkout@v2
|
||||
# Install Node 14
|
||||
- uses: actions/setup-node@v1
|
||||
- name: Check out code using Git
|
||||
uses: actions/checkout@v2
|
||||
- name: Set Node version to 16
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
version: 14
|
||||
- run: yarn install --frozen-lockfile --ignore-engines --ignore-scripts
|
||||
- run: node scripts/stats/index.js
|
||||
node-version: 16
|
||||
cache: 'yarn'
|
||||
- name: Install dependencies
|
||||
run: yarn install --frozen-lockfile --ignore-engines --ignore-scripts
|
||||
- name: Collect stats
|
||||
run: node scripts/stats/index.js
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Commit changes
|
||||
|
|
|
@ -142,7 +142,11 @@ class AstroBuilder {
|
|||
target: 'es2020', // must match an esbuild target
|
||||
},
|
||||
plugins: [
|
||||
rollupPluginHTML({ input, extractAssets: false }) as any, // "any" needed for CI; also we don’t need typedefs for this anyway
|
||||
rollupPluginHTML({
|
||||
rootDir: viteConfig.root,
|
||||
input,
|
||||
extractAssets: false,
|
||||
}) as any, // "any" needed for CI; also we don’t need typedefs for this anyway
|
||||
...(viteConfig.plugins || []),
|
||||
],
|
||||
publicDir: viteConfig.publicDir,
|
||||
|
|
|
@ -79,7 +79,8 @@ export async function ssr({ astroConfig, filePath, logging, mode, origin, pathna
|
|||
// Important: This needs to happen first, in case a renderer provides polyfills.
|
||||
const renderers = await resolveRenderers(viteServer, astroConfig);
|
||||
// Load the module from the Vite SSR Runtime.
|
||||
const mod = (await viteServer.ssrLoadModule(fileURLToPath(filePath))) as ComponentInstance;
|
||||
const viteFriendlyURL = `/@fs${filePath.pathname}`;
|
||||
const mod = (await viteServer.ssrLoadModule(viteFriendlyURL)) as ComponentInstance;
|
||||
// Handle dynamic routes
|
||||
let params: Params = {};
|
||||
let pageProps: Props = {};
|
||||
|
@ -174,7 +175,7 @@ export async function ssr({ astroConfig, filePath, logging, mode, origin, pathna
|
|||
}
|
||||
|
||||
// inject CSS
|
||||
[...getStylesForID(fileURLToPath(filePath), viteServer)].forEach((href) => {
|
||||
[...getStylesForID(filePath.pathname, viteServer)].forEach((href) => {
|
||||
tags.push({
|
||||
tag: 'link',
|
||||
attrs: { type: 'text/css', rel: 'stylesheet', href },
|
||||
|
@ -187,7 +188,7 @@ export async function ssr({ astroConfig, filePath, logging, mode, origin, pathna
|
|||
|
||||
// run transformIndexHtml() in dev to run Vite dev transformations
|
||||
if (mode === 'development') {
|
||||
html = await viteServer.transformIndexHtml(fileURLToPath(filePath), html, pathname);
|
||||
html = await viteServer.transformIndexHtml(filePath.pathname, html, pathname);
|
||||
}
|
||||
|
||||
return html;
|
||||
|
|
|
@ -46,7 +46,8 @@ export default function astro({ config, devServer }: AstroPluginOptions): vite.P
|
|||
}
|
||||
// pages and layouts should be transformed as full documents (implicit <head> <body> etc)
|
||||
// everything else is treated as a fragment
|
||||
const isPage = id.startsWith(fileURLToPath(config.pages)) || id.startsWith(fileURLToPath(config.layouts));
|
||||
const normalizedID = fileURLToPath(new URL(`file://${id}`));
|
||||
const isPage = normalizedID.startsWith(fileURLToPath(config.pages)) || id.startsWith(fileURLToPath(config.layouts));
|
||||
let source = await fs.promises.readFile(id, 'utf8');
|
||||
let tsResult: TransformResult | undefined;
|
||||
|
||||
|
|
|
@ -21179,7 +21179,7 @@ function htmlInlineScriptProxyPlugin(config) {
|
|||
if (proxyMatch) {
|
||||
const index = Number(proxyMatch[1]);
|
||||
const file = cleanUrl(id);
|
||||
const url = file.replace(config.root, '');
|
||||
const url = file.replace(normalizePath$4(config.root), '');
|
||||
const result = htmlProxyMap.get(config).get(url)[index];
|
||||
if (result) {
|
||||
return result;
|
||||
|
@ -21319,7 +21319,7 @@ function buildHtmlPlugin(config) {
|
|||
.map((child) => child.content || '')
|
||||
.join('');
|
||||
// <script type="module">...</script>
|
||||
const filePath = id.replace(config.root, '');
|
||||
const filePath = id.replace(normalizePath$4(config.root), '')
|
||||
addToHTMLProxyCache(config, filePath, inlineModuleIndex, contents);
|
||||
js += `\nimport "${id}?html-proxy&index=${inlineModuleIndex}.js"`;
|
||||
shouldRemove = true;
|
||||
|
@ -22950,7 +22950,6 @@ var commondir = function (basedir, relfiles) {
|
|||
);
|
||||
return ps.slice(0, i);
|
||||
}, files[0].split(/\/+|\\+/));
|
||||
|
||||
// Windows correctly handles paths with forward-slashes
|
||||
return res.length > 1 ? res.join('/') : '/'
|
||||
};
|
||||
|
@ -56977,14 +56976,14 @@ const devHtmlHook = async (html, { path: htmlPath, server, originalUrl }) => {
|
|||
processNodeUrl(src, s, config, htmlPath, originalUrl);
|
||||
}
|
||||
else if (isModule) {
|
||||
const url = filePath.replace(config.root, '');
|
||||
const url = filePath.replace(normalizePath$4(config.root), '');
|
||||
const contents = node.children
|
||||
.map((child) => child.content || '')
|
||||
.join('');
|
||||
// add HTML Proxy to Map
|
||||
addToHTMLProxyCache(config, url, scriptModuleIndex, contents);
|
||||
// inline js module. convert to src="proxy"
|
||||
s.overwrite(node.loc.start.offset, node.loc.end.offset, `<script type="module" src="${config.base + url.slice(1)}?html-proxy&index=${scriptModuleIndex}.js"></script>`);
|
||||
s.overwrite(node.loc.start.offset, node.loc.end.offset, `<script type="module" src="${filePath}?html-proxy&index=${scriptModuleIndex}.js"></script>`);
|
||||
}
|
||||
}
|
||||
// elements with [href/src] attrs
|
||||
|
|
Loading…
Reference in a new issue