Skip to content

Commit

Permalink
crates.io
Browse files Browse the repository at this point in the history
  • Loading branch information
alshdavid committed May 19, 2024
1 parent b1dcc36 commit 74a6d94
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ jobs:
- uses: actions/download-artifact@v4
with:
path: ${{ github.workspace }}/artifacts
- name: Publish NPM Package
- name: Publish Crate
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MACH_VERSION: ${{ needs.vars.outputs.NEXT_MACH_VERSION }}
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/release/publish-crate.bash
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,5 @@ ROOT_DIR=$(dirname $(dirname $(dirname $SCRIPT_DIR)))

source $ROOT_DIR/.github/workflows/platform/unix/setup.bash

sudo apt-get update
rustup target add x86_64-unknown-linux-gnu

just build-publish
cargo publish --package mach_bundler_core --token $CRATES_IO_API_TOKEN
55 changes: 38 additions & 17 deletions testing/fixtures/esm-simple/src/index.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,49 @@
import array_anon from './values/array_anon.js'
import * as array_anon_namespace from './values/array_anon.js'

import { array_named } from './values/array_named.js'
import * as array_named_namespace from './values/array_named.js'
// import object_anon from './values/object_anon.js'
// import object_anon from './values/object_named.js'

import class_anon from './values/class_anon.js'
import * as class_anon_namespace from './values/class_anon.js'

import { class_named } from './values/class_named.js'
import * as class_named_namespace from './values/class_named.js'

import object_anon from './values/object_anon.js'
import * as object_anon_namespace from './values/object_anon.js'

const output = globalThis.output = {}

output.array_anon_typeof = better_typeof(array_anon)
output.array_anon_0 = array_anon[0]
output.array_anon_namespace_default_0 = array_anon_namespace.default[0]

output.array_named_typeof = better_typeof(array_named)
output.array_named_0 = array_named[0]
output.array_named_namespace_array_named_0 = array_named_namespace.array_named[0]

output.class_anon_typeof = better_typeof(class_anon)
output.class_anon_new_data = new class_anon().data
output.class_anon_namespace_default_new_data = new class_anon_namespace.default().data

globalThis.array_anon_typeof = better_typeof(array_anon)
globalThis.array_anon_0 = array_anon[0]
globalThis.array_anon_namespace_default_0 = array_anon_namespace.default[0]
output.class_named_typeof = better_typeof(class_named)
output.class_named_new_data = new class_named().data
output.class_named_namespace_class_named_new_data = new class_named_namespace.class_named().data
output.class_named_namespace_default_new_data = new class_named_namespace.default().data

globalThis.array_named_0 = array_named[0]
globalThis.array_named_namespace_array_named_0 = array_named_namespace.array_named[0]
output.object_anon_typeof = better_typeof(object_anon)
output.object_anon_data = object_anon.data
output.object_anon_namespace_object_anon_data = object_anon_namespace.default.data

console.log([
globalThis.array_anon_typeof,
globalThis.array_anon_0,
globalThis.array_anon_namespace_default_0,
globalThis.array_named_0,
globalThis.array_named_namespace_array_named_0,
])
console.log(output)

function better_typeof(target) {
if (Array.isArray(target)) return 'array'
if (target && typeof target === "object" && (/^(object|array)$/i.test(target.constructor.name) === false)) return 'class_constructor'
typeof target
if (Array.isArray(target)) {
return 'array'
}
if (target && typeof target === "object" && (/^(object|array)$/i.test(target.constructor.name) === false)) {
return 'class_constructor'
}
return typeof target
}
2 changes: 1 addition & 1 deletion testing/fixtures/esm-simple/src/values/class_anon.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export default class {
data
constructor() {
data = 'function_anon_default'
this.data = 'function_anon_default'
}
}
4 changes: 2 additions & 2 deletions testing/fixtures/esm-simple/src/values/class_named.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
export class class_named {
data
constructor() {
data = 'class_named'
this.data = 'class_named'
}
}

export default class class_named_default {
data
constructor() {
data = 'function_named_default'
this.data = 'function_named_default'
}
}

0 comments on commit 74a6d94

Please sign in to comment.