Skip to content

Commit 461f9b7

Browse files
authored
SPDX license format (#2667)
* Switch to SPDX license format for all non-codegen files * Add test to ensure all committed JS files have SPDX header
1 parent afc8333 commit 461f9b7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+138
-2308
lines changed

.buildkite/make.mjs

+2-16
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,6 @@
11
/*
2-
* Licensed to Elasticsearch B.V. under one or more contributor
3-
* license agreements. See the NOTICE file distributed with
4-
* this work for additional information regarding copyright
5-
* ownership. Elasticsearch B.V. licenses this file to you under
6-
* the Apache License, Version 2.0 (the "License"); you may
7-
* not use this file except in compliance with the License.
8-
* You may obtain a copy of the License at
9-
*
10-
* http://www.apache.org/licenses/LICENSE-2.0
11-
*
12-
* Unless required by applicable law or agreed to in writing,
13-
* software distributed under the License is distributed on an
14-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15-
* KIND, either express or implied. See the License for the
16-
* specific language governing permissions and limitations
17-
* under the License.
2+
* Copyright Elasticsearch B.V. and contributors
3+
* SPDX-License-Identifier: Apache-2.0
184
*/
195

206
/* global $ argv */

.github/workflows/nodejs.yml

+3
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ jobs:
8383
run: |
8484
npm run license-checker
8585
86+
- name: SPDX header check
87+
run: npm run license-header
88+
8689
test-bun:
8790
name: Test Bun
8891
runs-on: ${{ matrix.os }}

docs/examples/proxy/api/autocomplete.js

+2-16
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,6 @@
11
/*
2-
* Licensed to Elasticsearch B.V. under one or more contributor
3-
* license agreements. See the NOTICE file distributed with
4-
* this work for additional information regarding copyright
5-
* ownership. Elasticsearch B.V. licenses this file to you under
6-
* the Apache License, Version 2.0 (the "License"); you may
7-
* not use this file except in compliance with the License.
8-
* You may obtain a copy of the License at
9-
*
10-
* http://www.apache.org/licenses/LICENSE-2.0
11-
*
12-
* Unless required by applicable law or agreed to in writing,
13-
* software distributed under the License is distributed on an
14-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15-
* KIND, either express or implied. See the License for the
16-
* specific language governing permissions and limitations
17-
* under the License.
2+
* Copyright Elasticsearch B.V. and contributors
3+
* SPDX-License-Identifier: Apache-2.0
184
*/
195

206
// IMPORTANT: this is not a production ready code & purely for demonstration purposes,

docs/examples/proxy/api/delete.js

+2-16
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,6 @@
11
/*
2-
* Licensed to Elasticsearch B.V. under one or more contributor
3-
* license agreements. See the NOTICE file distributed with
4-
* this work for additional information regarding copyright
5-
* ownership. Elasticsearch B.V. licenses this file to you under
6-
* the Apache License, Version 2.0 (the "License"); you may
7-
* not use this file except in compliance with the License.
8-
* You may obtain a copy of the License at
9-
*
10-
* http://www.apache.org/licenses/LICENSE-2.0
11-
*
12-
* Unless required by applicable law or agreed to in writing,
13-
* software distributed under the License is distributed on an
14-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15-
* KIND, either express or implied. See the License for the
16-
* specific language governing permissions and limitations
17-
* under the License.
2+
* Copyright Elasticsearch B.V. and contributors
3+
* SPDX-License-Identifier: Apache-2.0
184
*/
195

206
// IMPORTANT: this is not a production ready code & purely for demonstration purposes,

docs/examples/proxy/api/index.js

+2-16
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,6 @@
11
/*
2-
* Licensed to Elasticsearch B.V. under one or more contributor
3-
* license agreements. See the NOTICE file distributed with
4-
* this work for additional information regarding copyright
5-
* ownership. Elasticsearch B.V. licenses this file to you under
6-
* the Apache License, Version 2.0 (the "License"); you may
7-
* not use this file except in compliance with the License.
8-
* You may obtain a copy of the License at
9-
*
10-
* http://www.apache.org/licenses/LICENSE-2.0
11-
*
12-
* Unless required by applicable law or agreed to in writing,
13-
* software distributed under the License is distributed on an
14-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15-
* KIND, either express or implied. See the License for the
16-
* specific language governing permissions and limitations
17-
* under the License.
2+
* Copyright Elasticsearch B.V. and contributors
3+
* SPDX-License-Identifier: Apache-2.0
184
*/
195

206
// IMPORTANT: this is not a production ready code & purely for demonstration purposes,

docs/examples/proxy/api/search.js

+2-16
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,6 @@
11
/*
2-
* Licensed to Elasticsearch B.V. under one or more contributor
3-
* license agreements. See the NOTICE file distributed with
4-
* this work for additional information regarding copyright
5-
* ownership. Elasticsearch B.V. licenses this file to you under
6-
* the Apache License, Version 2.0 (the "License"); you may
7-
* not use this file except in compliance with the License.
8-
* You may obtain a copy of the License at
9-
*
10-
* http://www.apache.org/licenses/LICENSE-2.0
11-
*
12-
* Unless required by applicable law or agreed to in writing,
13-
* software distributed under the License is distributed on an
14-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15-
* KIND, either express or implied. See the License for the
16-
* specific language governing permissions and limitations
17-
* under the License.
2+
* Copyright Elasticsearch B.V. and contributors
3+
* SPDX-License-Identifier: Apache-2.0
184
*/
195

206
// IMPORTANT: this is not a production ready code & purely for demonstration purposes,

docs/examples/proxy/utils/authorize.js

+2-16
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,6 @@
11
/*
2-
* Licensed to Elasticsearch B.V. under one or more contributor
3-
* license agreements. See the NOTICE file distributed with
4-
* this work for additional information regarding copyright
5-
* ownership. Elasticsearch B.V. licenses this file to you under
6-
* the Apache License, Version 2.0 (the "License"); you may
7-
* not use this file except in compliance with the License.
8-
* You may obtain a copy of the License at
9-
*
10-
* http://www.apache.org/licenses/LICENSE-2.0
11-
*
12-
* Unless required by applicable law or agreed to in writing,
13-
* software distributed under the License is distributed on an
14-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15-
* KIND, either express or implied. See the License for the
16-
* specific language governing permissions and limitations
17-
* under the License.
2+
* Copyright Elasticsearch B.V. and contributors
3+
* SPDX-License-Identifier: Apache-2.0
184
*/
195

206
// IMPORTANT: this is not a production ready code & purely for demonstration purposes,

docs/examples/proxy/utils/prepare-elasticsearch.js

+2-16
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,6 @@
11
/*
2-
* Licensed to Elasticsearch B.V. under one or more contributor
3-
* license agreements. See the NOTICE file distributed with
4-
* this work for additional information regarding copyright
5-
* ownership. Elasticsearch B.V. licenses this file to you under
6-
* the Apache License, Version 2.0 (the "License"); you may
7-
* not use this file except in compliance with the License.
8-
* You may obtain a copy of the License at
9-
*
10-
* http://www.apache.org/licenses/LICENSE-2.0
11-
*
12-
* Unless required by applicable law or agreed to in writing,
13-
* software distributed under the License is distributed on an
14-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15-
* KIND, either express or implied. See the License for the
16-
* specific language governing permissions and limitations
17-
* under the License.
2+
* Copyright Elasticsearch B.V. and contributors
3+
* SPDX-License-Identifier: Apache-2.0
184
*/
195

206
'use strict'

index.d.ts

+2-16
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,6 @@
11
/*
2-
* Licensed to Elasticsearch B.V. under one or more contributor
3-
* license agreements. See the NOTICE file distributed with
4-
* this work for additional information regarding copyright
5-
* ownership. Elasticsearch B.V. licenses this file to you under
6-
* the Apache License, Version 2.0 (the "License"); you may
7-
* not use this file except in compliance with the License.
8-
* You may obtain a copy of the License at
9-
*
10-
* http://www.apache.org/licenses/LICENSE-2.0
11-
*
12-
* Unless required by applicable law or agreed to in writing,
13-
* software distributed under the License is distributed on an
14-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15-
* KIND, either express or implied. See the License for the
16-
* specific language governing permissions and limitations
17-
* under the License.
2+
* Copyright Elasticsearch B.V. and contributors
3+
* SPDX-License-Identifier: Apache-2.0
184
*/
195

206
import Client from './lib/client'

index.js

+2-16
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,6 @@
11
/*
2-
* Licensed to Elasticsearch B.V. under one or more contributor
3-
* license agreements. See the NOTICE file distributed with
4-
* this work for additional information regarding copyright
5-
* ownership. Elasticsearch B.V. licenses this file to you under
6-
* the Apache License, Version 2.0 (the "License"); you may
7-
* not use this file except in compliance with the License.
8-
* You may obtain a copy of the License at
9-
*
10-
* http://www.apache.org/licenses/LICENSE-2.0
11-
*
12-
* Unless required by applicable law or agreed to in writing,
13-
* software distributed under the License is distributed on an
14-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15-
* KIND, either express or implied. See the License for the
16-
* specific language governing permissions and limitations
17-
* under the License.
2+
* Copyright Elasticsearch B.V. and contributors
3+
* SPDX-License-Identifier: Apache-2.0
184
*/
195

206
'use strict'

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"lint": "ts-standard src",
2323
"lint:fix": "ts-standard --fix src",
2424
"license-checker": "license-checker --production --onlyAllow='MIT;Apache-2.0;Apache1.1;ISC;BSD-3-Clause;BSD-2-Clause;0BSD'",
25+
"license-header": "./scripts/check-spdx",
2526
"prebuild": "npm run clean-build && npm run lint",
2627
"build": "tsc && rm lib/package.json && mv lib/src/* lib/ && rm -rf lib/src",
2728
"clean-build": "rimraf ./lib && mkdir lib",

scripts/check-spdx

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright Elasticsearch B.V. and contributors
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
correct='/*
7+
* Copyright Elasticsearch B.V. and contributors
8+
* SPDX-License-Identifier: Apache-2.0
9+
*/'
10+
11+
the_exit=0
12+
13+
check_file() {
14+
if $(diff <(head -n4 "$1") <(echo "$correct") &>/dev/null); then
15+
echo "Correct: $1"
16+
else
17+
echo "Incorrect: $1"
18+
the_exit=1
19+
fi
20+
}
21+
22+
echo "SPDX license header check"
23+
for file in $(git ls-files | grep -E '\.(ts|js|mjs)$'); do
24+
check_file "$file"
25+
done
26+
27+
exit "$the_exit"

scripts/download-artifacts.js

+2-16
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,6 @@
11
/*
2-
* Licensed to Elasticsearch B.V. under one or more contributor
3-
* license agreements. See the NOTICE file distributed with
4-
* this work for additional information regarding copyright
5-
* ownership. Elasticsearch B.V. licenses this file to you under
6-
* the Apache License, Version 2.0 (the "License"); you may
7-
* not use this file except in compliance with the License.
8-
* You may obtain a copy of the License at
9-
*
10-
* http://www.apache.org/licenses/LICENSE-2.0
11-
*
12-
* Unless required by applicable law or agreed to in writing,
13-
* software distributed under the License is distributed on an
14-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15-
* KIND, either express or implied. See the License for the
16-
* specific language governing permissions and limitations
17-
* under the License.
2+
* Copyright Elasticsearch B.V. and contributors
3+
* SPDX-License-Identifier: Apache-2.0
184
*/
195

206
'use strict'

scripts/generate-docs-examples.js

+2-16
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,6 @@
11
/*
2-
* Licensed to Elasticsearch B.V. under one or more contributor
3-
* license agreements. See the NOTICE file distributed with
4-
* this work for additional information regarding copyright
5-
* ownership. Elasticsearch B.V. licenses this file to you under
6-
* the Apache License, Version 2.0 (the "License"); you may
7-
* not use this file except in compliance with the License.
8-
* You may obtain a copy of the License at
9-
*
10-
* http://www.apache.org/licenses/LICENSE-2.0
11-
*
12-
* Unless required by applicable law or agreed to in writing,
13-
* software distributed under the License is distributed on an
14-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15-
* KIND, either express or implied. See the License for the
16-
* specific language governing permissions and limitations
17-
* under the License.
2+
* Copyright Elasticsearch B.V. and contributors
3+
* SPDX-License-Identifier: Apache-2.0
184
*/
195

206
const { join } = require('path')

0 commit comments

Comments
 (0)