Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete the out-node build #3160

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 1 addition & 10 deletions Gruntfile.js → Gruntfile.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module.exports = function (grunt) {
pkg: grunt.file.readJSON('package.json'),

clean: {
out: ['gen/', 'out/', 'out-wpt/', 'out-node/'],
out: ['gen/', 'out/', 'out-wpt/'],
},

run: {
Expand Down Expand Up @@ -89,14 +89,6 @@ module.exports = function (grunt) {
'--ignore=src/common/tools',
],
},
'build-out-node': {
cmd: 'node',
args: [
'node_modules/typescript/lib/tsc.js',
'--project', 'node.tsconfig.json',
'--outDir', 'out-node/',
],
},
'copy-assets': {
cmd: 'node',
args: [
Expand Down Expand Up @@ -188,7 +180,6 @@ module.exports = function (grunt) {
tasks: [
'build-standalone',
'build-wpt',
'run:build-out-node',
],
},
'all-checks': {
Expand Down
2 changes: 1 addition & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = function (api) {
export default function (api) {
api.cache(true);
return {
presets: ['@babel/preset-typescript'],
Expand Down
1 change: 0 additions & 1 deletion cts.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
"deploy_key.enc": true,
"node_modules": true,
"out": true,
"out-node": true,
"out-wpt": true,
"docs/tsdoc": true,
"package-lock.json": true
Expand Down
20 changes: 0 additions & 20 deletions node.tsconfig.json

This file was deleted.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "@webgpu/cts",
"version": "0.1.0",
"description": "WebGPU Conformance Test Suite",
"type": "module",
"scripts": {
"test": "grunt all",
"all": "grunt all",
Expand Down
6 changes: 3 additions & 3 deletions src/common/runtime/helper/sys.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* eslint no-process-exit: "off" */
/* eslint @typescript-eslint/no-namespace: "off" */

function node() {
const { existsSync } = require('fs');
async function node() {
const { existsSync } = await import('fs');

return {
type: 'node',
Expand Down Expand Up @@ -41,6 +41,6 @@ function deno() {
};
}

const sys = typeof globalThis.process !== 'undefined' ? node() : deno();
const sys = typeof globalThis.process !== 'undefined' ? await node() : deno();

export default sys;
3 changes: 3 additions & 0 deletions src/common/tools/commonjs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"type": "commonjs"
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const path = require('path');
// Automatically transpile .ts imports
require('ts-node').register({
// Specify the project file so ts-node doesn't try to find it itself based on the CWD.
project: path.resolve(__dirname, '../../../tsconfig.json'),
project: path.resolve(__dirname, '../../../../tsconfig.json'),
compilerOptions: {
module: 'commonjs',
},
Expand Down
2 changes: 1 addition & 1 deletion src/common/tools/version.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const version = require('child_process')
export const version = (await import('child_process'))
.execSync('git describe --always --abbrev=0 --dirty')
.toString()
.trim();
1 change: 0 additions & 1 deletion src/webgpu/web_platform/worker/worker.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ g.test('worker')
// is using commonjs which doesn't support import.meta. Further,
// we need to put the url in a string add pass the string to import
// otherwise typescript tries to parse the file which again, fails.
// worker_launcher.js is excluded in node.tsconfig.json.
const url = './worker_launcher.js';
const { launchWorker } = await import(url);
const result = await launchWorker();
Expand Down
2 changes: 1 addition & 1 deletion tools/checklist
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
// and every query in it is valid (e.g. renames have been applied, and new tests added
// to the spreadsheet have also been added to the CTS).

require('../src/common/tools/setup-ts-in-node.js');
require('../src/common/tools/commonjs/setup-ts-in-node.js');
require('../src/common/tools/checklist.ts');
2 changes: 1 addition & 1 deletion tools/dev_server
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env node

require('../src/common/tools/setup-ts-in-node.js');
require('../src/common/tools/commonjs/setup-ts-in-node.js');
require('../src/common/tools/dev_server.ts');
2 changes: 1 addition & 1 deletion tools/gen_cache
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env node

require('../src/common/tools/setup-ts-in-node.js');
require('../src/common/tools/commonjs/setup-ts-in-node.js');
require('../src/common/tools/gen_cache.ts');
2 changes: 1 addition & 1 deletion tools/gen_listings
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
// Crawl a suite directory (e.g. src/webgpu/) to generate a listing.js containing
// the listing of test files in the suite.

require('../src/common/tools/setup-ts-in-node.js');
require('../src/common/tools/commonjs/setup-ts-in-node.js');
require('../src/common/tools/gen_listings.ts');
4 changes: 2 additions & 2 deletions tools/gen_version
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

/* eslint-disable no-console */

require('../src/common/tools/setup-ts-in-node.js');
require('../src/common/tools/commonjs/setup-ts-in-node.js');
const fs = require('fs');

const myself = 'tools/gen_version';
Expand All @@ -14,7 +14,7 @@ if (!fs.existsSync(myself)) {
process.exit(1);
}

const { version } = require('../src/common/tools/version.ts');
const { version } = require('../src/common/tools/version.ts'); // FIXME doesn't work because in order to require the placeholder version.ts it needs to be commonjs, but we can't configure that for a single file

fs.mkdirSync('./gen/common/internal', { recursive: true });
// This will be copied into the various other build directories.
Expand Down
2 changes: 1 addition & 1 deletion tools/gen_wpt_cts_html
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@
// ?q=webgpu:a/bar:bar1={"x":3} <- [ Mac ]
// ?q=webgpu:a/bar:bar2~

require('../src/common/tools/setup-ts-in-node.js');
require('../src/common/tools/commonjs/setup-ts-in-node.js');
require('../src/common/tools/gen_wpt_cts_html.ts');
2 changes: 1 addition & 1 deletion tools/merge_listing_times
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// See `docs/adding_timing_metadata.md` for an explanation of listing times, and
// a walkthrough on adding entries for new tests.

require('../src/common/tools/setup-ts-in-node.js');
require('../src/common/tools/commonjs/setup-ts-in-node.js');

// See the help message in this file for info on how to use the tool.
require('../src/common/tools/merge_listing_times.ts');
3 changes: 3 additions & 0 deletions tools/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"type": "commonjs"
}
2 changes: 1 addition & 1 deletion tools/run_node
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

// Run test suites under node.

require('../src/common/tools/setup-ts-in-node.js');
require('../src/common/tools/commonjs/setup-ts-in-node.js');
require('../src/common/runtime/cmdline.ts');
2 changes: 1 addition & 1 deletion tools/run_wpt_ref_tests
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env node

require('../src/common/tools/setup-ts-in-node.js');
require('../src/common/tools/commonjs/setup-ts-in-node.js');
require('../src/common/tools/run_wpt_ref_tests.ts');
2 changes: 1 addition & 1 deletion tools/validate
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

// Validate several properties of test files and the tests in them.

require('../src/common/tools/setup-ts-in-node.js');
require('../src/common/tools/commonjs/setup-ts-in-node.js');
require('../src/common/tools/validate.ts');
Loading